#45. 字符串去重并映射零值

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

字符串去重并映射零值

String Map Zero Values

Background

Congcong is learning how to process and organize data. He encountered an interesting problem that requires him to organize a group of strings and assign a specific initial value to each unique string.

Problem Description

Given an array of strings, return a Map<String, Integer> containing a key for every different string in the array, always with the value 00. For example, the string "hello" makes the pair "hello":0. We'll do more complicated counting later, but for this problem the value is simply 00.

Input Format

Input is given from standard input in the following format.

Multiple strings, separated by spaces.

Output Format

Output is printed to standard output in the following format.

A Map<String, Integer>, represented in JSON format, where keys are unique strings and values are all 00.

Sample

"a" "b" "a" "b"
{"a": 0, "b": 0}
"a" "b" "a" "c" "b"
{"a": 0, "b": 0, "c": 0}
"c" "b" "a"
{"a": 0, "b": 0, "c": 0}

Sample Explanation

For the first sample input "a" "b" "a" "b", the unique strings in the array are "a" and "b". Therefore, the output map contains these two keys, with their values both set to 00, i.e., {"a": 0, "b": 0}.

Constraints

Time limit for each test case is 11 second, and memory limit is 10241024 KiB.