All Tracks Data Structures Hash Tables Basics of Hash Tables Problem

Frequency of Students
/
No tags
Problem
Editorial
Analytics

There is a class consisting of 'N' students . There can be many students with the same name.

Now, you have to print the names of the students followed by there frequency as shown in the sample explanation given below.

Output the names in the lexicographical order.

Input :

  • First line contains an integer 'N', i.e the no. of students in the class.
  • Next 'N' lines contains the names of the students.

Output:

  • Each line consists of the name of student space and separated its frequency.

Constraints:

  • 1<=N<=1000
  • string length<=100
  • string consists of lowercase letters

Note : For practicing use Map technique only .

SAMPLE INPUT
5
sumit
ambuj
himanshu
ambuj
ambuj
SAMPLE OUTPUT
ambuj 3
himanshu 1
sumit 1
Explanation

There are 5 students in a class, 3 students whose name is ambuj, 1 student having name himanshu and 1 student named sumit.

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

Best Submission

Similar Problems

Contributors

Initializing Code Editor...
Notifications
View All Notifications

?