D. Occurring Dilemma

3.2

16 votes
frequency array, Easy
Problem

Stuti has challenged you to count the number of occurrence of different alphabets in a string. To add challenge to task she makes sure that every string she provide is greater than 10 in length . Make a program to calculate number of occurrence of every character in the string.

INPUT FORMAT :
First line of input will contain an integer N, denoting number of strings she will give you.
Following N lines will contain one string S having lowercase and uppercase English alphabets ie., [A-Z] & [a-z].

OUTPUT FORMAT :
Your output should contain N lines, each line containing the character immediately followed by the number of occurrences.

CONSTRAINTS :
1≤ N ≤103
11≤ length of S ≤ 104

Sample Input
2
AAAAAaaaaax
ABCDEabcdex
Sample Output
A5 a5 x1
A1 B1 C1 D1 E1 a1 b1 c1 d1 e1 x1
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Sample inputs and output are self-explanatory in itself. NOTE : Output should be in a specific format : if more than one alphabets are given, then you should print occurrences for A B C ....... Z and then that of a b c ...... z

Editor Image

?