#C11751. Flatten a Nested Dictionary

    ID: 41102 Type: Default 1000ms 256MiB

Flatten a Nested Dictionary

Flatten a Nested Dictionary

You are given a nested dictionary (in JSON format) and your task is to flatten it. In the flattened dictionary, each key is constructed by concatenating the keys from the root to the corresponding value using a period . as the separator.

For example, given an input dictionary {"a": {"b": 1}}, the output should be {"a.b": 1}.

If the input is not a valid JSON object (i.e. a dictionary), you should output null.

Note: All formulas or technical terms should be written in LaTeX format where applicable. For instance, the key concatenation uses the separator $\texttt{.}$.

inputFormat

The input is given via stdin as a single line containing a JSON representation of a dictionary. The dictionary may be nested. If the input does not represent a valid dictionary, the program should output null.

outputFormat

Output the flattened dictionary in JSON format to stdout. If the input is not a valid dictionary, output null.

## sample
{}
{}