A form holds field state. Events, one per line: set FIELD VALUE. Print the final form state as JSON with keys sorted.
Input: event lines. Output: form state JSON.
Your program reads from stdin and prints to stdout.
Example 1
Input: set email a@b.c set name Ada set email x@y.z
Output: {"email":"x@y.z","name":"Ada"}
Hints
A form holds field state. Events, one per line: set FIELD VALUE. Print the final form state as JSON with keys sorted.
Input: event lines. Output: form state JSON.
Your program reads from stdin and prints to stdout.
Example 1
Input: set email a@b.c set name Ada set email x@y.z
Output: {"email":"x@y.z","name":"Ada"}
Hints