QWERTY03 - JAVA COUNTING

Java counting

Problem Statement:

You are given a list of characters in English alphabets (ASCII>=97). Sort the characters and give the number of occurrences of every character.

Input Specification:

The first line contains an integer n, the number of characters, followed by n lines with a character in every line.

Output Specification:

Print the characters in sorted order with no duplicates.

Output format : “character < space > no_of_occurances”

Input Constraints:

1<=n<=100

 

Sample Input:

5

a

f

b

a

f

Sample Output:

a 2

b 1

f 2


Added by:cegprakash
Date:2012-01-09
Time limit:1s
Source limit:500B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:JAVA

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.