Tina is given a string SS which contains the first letter of all the student names in her class. She got a curiosity to check how many people have their names starting from the same alphabet. So given a string SS, she decided to write a code that finds out the count of characters that occur more than once in the string.
The first line contains an integer TT, denoting the number of test cases. Each test case consists of a string SS containing only lowercase characters.
For each test case on a new line, print the output in the format
character=count . If multiple characters have more than one count, print all of them separated by space, in alphabetical order. In case no such character is present print −1−1.
1<=T<=71<=T<=7 1<=|S|<=1071<=|S|<=107, where |S||S| denotes length of string SS.
33 prepbytes java algorithm
Sample test case explanation
In the first string character
p is occuring 2 times and character
e is occuring 2 times. Printing them in alphabetical order we get,