Duplicate Character
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.
Input format
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.
Output format
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.
Constraints
1<=T<=71<=T<=7 1<=|S|<=1071<=|S|<=107, where |S||S| denotes length of string SS.
Time limit
11 secon
Example
Input
33 prepbytes java algorithm
Output
e=2 p=2
a=2
−1
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,
e=2 p=2
question link=https://mycode.prepbytes.com/problems/strings/DUPTCHAR