#C13195. String Length Mapping

    ID: 42706 Type: Default 1000ms 256MiB

String Length Mapping

String Length Mapping

This problem requires you to compute the length of each string from a list of strings and output the results as a JSON formatted dictionary. For each string, use the string itself as the key and its length as the value. If a string appears more than once, its key should simply be updated (note that the length is always the same) and appear only once in the final dictionary.

Note: The input is taken from standard input (stdin) and the output should be printed to standard output (stdout) in JSON format.

Mathematically, if we denote a string by \( s \), then the length is given by \( |s| \). For a list of strings \( [s_1, s_2, \dots, s_n] \), the expected result is \[ { s_1: |s_1|, s_2: |s_2|, \dots, s_n: |s_n| } \] Note that duplicate strings should only appear once in the dictionary.

inputFormat

The first line of input contains a single integer \( n \) which indicates the number of strings. Each of the following \( n \) lines contains one non-empty string.

outputFormat

Output a JSON dictionary where each key is a string from the input and its corresponding value is the length of that string. The dictionary should be printed to standard output (stdout).

## sample
1
hello
{"hello": 5}