#C12788. Strings to Lengths Dictionary
Strings to Lengths Dictionary
Strings to Lengths Dictionary
Given a list of strings, your task is to create a JSON dictionary mapping each string to its length. For a string ( s ), the length is defined as ( |s| ). The input will start with an integer ( n ) representing the number of strings, followed by ( n ) lines each containing a single string. You need to compute the length of each string and output the result as a JSON object where each key is a string from the input and its corresponding value is the length.
inputFormat
Input is read from standard input (stdin). The first line contains an integer ( n ) (( n \ge 0 )) representing the number of strings. Each of the next ( n ) lines contains a single string.
outputFormat
Output the JSON representation of a dictionary (object) where keys are the input strings and values are their respective lengths. The output should be written to standard output (stdout) without any additional characters.## sample
0
{}