#C130. Flashcard Generator

    ID: 42489 Type: Default 1000ms 256MiB

Flashcard Generator

Flashcard Generator

You are given a string that contains multiple term-definition pairs. Each pair is separated by a semicolon (;) and within each pair, the term and its definition are separated by a colon (:). Your task is to parse this string and generate a list of flashcards.

Each flashcard should be represented as an object (or dictionary) that contains two keys: term and definition. If the input string is empty or null, then the output should be an empty list.

Note: When processing each pair, make sure to trim extra whitespace from the term and the definition. You must read input from standard input and write your output to standard output in JSON format.

inputFormat

The input consists of a single line string from standard input (STDIN). This string includes multiple term-definition pairs separated by semicolons (;). In each pair, the term and definition are separated by a colon (:).

outputFormat

Output the list of flashcards in JSON format to standard output (STDOUT). Each flashcard should be an object with two keys: term and definition.

## sample
ruby:A dynamic, open source programming language;python:A powerful, high-level programming language
[{"term": "ruby", "definition": "A dynamic, open source programming language"}, {"term": "python", "definition": "A powerful, high-level programming language"}]