Proposal's

2.9

43 votes
Problem

Priya is so much beautiful , everybody want to be in a relationship with her . So it 's the Valentine's day , many person come to propose her but she can't decide what to do . So she simply follow a rule the person which request her most will be selected by her. So you have to find the person which request her most.

Input :

The first line contains T - number of test cases . Each of next T lines contain a string S.

Output :

For each test case you need to print maximum occurring characters with their count followed by a single space.

Constraints :

1<=T<=50
1<=|S|<=100, where |S| denotes the length of string S.

Note : Output will be in sorted manner !

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation
  1. Here abc occurs same times : abc 2

  2. Here a occurs maximum times then others : a 2

  3. Here everyone has the same occurring frequency : abcdefgh 1

Editor Image

?