#C13751. String Length Dictionary

    ID: 43324 Type: Default 1000ms 256MiB

String Length Dictionary

String Length Dictionary

Given a list of strings, your task is to build a dictionary (or map) that associates each string with its length. The dictionary should preserve the order of input and the case of the strings. For each string s, its length is determined by the number of characters it contains, i.e., \(\ell(s) = |s|\).

Example: For the input list ["apple", "banana", "cherry"], the output should be { 'apple': 5, 'banana': 6, 'cherry': 6 }.

You need to implement a solution that reads input from standard input (stdin) and outputs the result to standard output (stdout) in exactly the format described.

inputFormat

The input is given via standard input (stdin) in the following format:

  • The first line contains an integer \(n\) which represents the number of strings.
  • The next \(n\) lines each contain one string.

Note: \(n\) can be zero, in which case no further lines follow.

outputFormat

Output a single line to standard output (stdout) representing a dictionary (or map) in the following format:

{'string1': length1, 'string2': length2, ...}

The keys are the strings exactly as input (case sensitive) and the values are their corresponding lengths. Ensure that the output format matches exactly, including the placement of quotes, colons, commas, and braces.

## sample
3
apple
banana
cherry
{'apple': 5, 'banana': 6, 'cherry': 6}