#52. 字符串出现次数统计
字符串出现次数统计
String Occurrence Count
Background
Congcong is organizing his files and has found many duplicate file names. To better manage these files, he wants to count the occurrences of each file name.
Problem Description
Given an array of strings, return a Map<String, Boolean>. Each distinct string in the array should be a key in the map, and its value should be true if that string appears or more times in the array, otherwise false.
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, Boolean>indicating whether each string appears or more times.
Sample
"a" "b" "a" "c" "b"
{"a": true, "b": true, "c": false}
"c" "b" "a"
{"a": false, "b": false, "c": false}
"c" "c" "c" "c"
{"c": true}
Sample Explanation
In Sample , string "a" appears times, "b" appears times, and "c" appears time. Thus, the values for "a" and "b" are true, and for "c" is false.
In Sample , all strings appear only time, so all values are false.
In Sample , string "c" appears times, so its value is true.
Constraints
Time limit: second, Memory limit: KiB for each test case.