#K49977. Hackathon Registration Parsing

    ID: 28762 Type: Default 1000ms 256MiB

Hackathon Registration Parsing

Hackathon Registration Parsing

You are given a registration string that contains pairs of participant names and project names separated by commas and spaces. Your task is to parse the input string and produce a list of entries where each entry is a dictionary (or equivalent structure in your chosen language) with keys participant and project.

If the input string is empty or "None", the output should be an empty list. If the input contains an odd number of comma‐separated values, your program should output an error message:

\(\texttt{Input string must contain an even number of elements.}\)

Input/Output Method: Your solution should read from standard input and write to standard output.

inputFormat

The input consists of a single line containing the registration string. The participants' names and their respective project names are separated by a comma followed by a space (", "). The input can also be the string "None" or an empty string.

outputFormat

If the input is valid, output the list of registrations in the following format:

[{'participant': 'Name1', 'project': 'Project1'}, {'participant': 'Name2', 'project': 'Project2'}, ...]

If the number of comma-separated values is odd, output exactly the following error message:

Input string must contain an even number of elements.
## sample
Alice Johnson, Project A, Bob Smith, Project B
[{'participant': 'Alice Johnson', 'project': 'Project A'}, {'participant': 'Bob Smith', 'project': 'Project B'}]