#47. 字符串长度映射统计

    ID: 47 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatMap-2gesp5字符串STL

字符串长度映射统计

String Length Map

Background

Congcong is currently learning how to process string data. He wants to write a program that can quickly determine the length of each distinct string in a given array of strings and store this information in an easily queryable data structure.

Problem Description

Given an array of strings, return a Map<String, Integer> containing a key for every different string in the array, and the value is that string's length.

Input Format

Input is given from standard input in the following format.

The input consists of a single line containing several space-separated strings.

Output Format

Output is printed to standard output in the following format.

Output a map (Map<String, Integer>) where keys are the distinct strings from the input, and values are their corresponding lengths. The order of key-value pairs may not be fixed.

Sample

"a" "bb" "a" "bb"
{"bb": 2, "a": 1}
"this" "and" "that" "and"
{"that": 4, "and": 3, "this": 4}
"code" "code" "code" "bug"
{"code": 4, "bug": 3}

Constraints

Time limit: 11 second, Memory limit: 10241024 KiB for each test case.