#50. 字符串首字符分组拼接
字符串首字符分组拼接
Group and Concatenate by First Character
Background
Congcong is learning how to process string data. He encountered a problem that requires grouping a set of strings by their first character and concatenating the strings within each group in their original order.
Problem Description
Given an array of non-empty strings, return a Map<String, String> with a key for every different first character seen, with the value of all the strings starting with that character appended together in the order they appear in the array.
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 string representation of the Map, where the order of key-value pairs is not specified.
Sample
"salt" "tea" "soda" "toast"
{"s": "saltsoda\