Parse useSearchParams style queries. Input: a URL query string (no leading ?), e.g. a=1&b=hello&a=2 — repeated keys keep the LAST value; values are URL-decoded. Print the result as JSON with keys sorted.
Input: one query string. Output: JSON object.
Your program reads from stdin and prints to stdout.
Example 1
Input: a=1&b=hello
Output: {"a":"1","b":"hello"}
Hints
Parse useSearchParams style queries. Input: a URL query string (no leading ?), e.g. a=1&b=hello&a=2 — repeated keys keep the LAST value; values are URL-decoded. Print the result as JSON with keys sorted.
Input: one query string. Output: JSON object.
Your program reads from stdin and prints to stdout.
Example 1
Input: a=1&b=hello
Output: {"a":"1","b":"hello"}
Hints