#C8491. Count Strings Frequency
Count Strings Frequency
Count Strings Frequency
Given a list of strings, your task is to count the frequency of each unique string. The counting is case sensitive; for example, apple
and Apple
are considered different. Formally, if there are (n) strings and a particular string (s) appears (f) times, then your program should output (s) along with (f). The output should be listed in lexicographical order, i.e. sorted according to ASCII values.
inputFormat
The input is read from standard input (stdin). The first line contains an integer (n) (where (n \ge 0)) representing the number of strings. The following (n) lines each contain a non-empty string.
outputFormat
For each unique string, print a line containing the string and its frequency separated by a space. The output lines must be sorted in lexicographical order.## sample
6
apple
banana
apple
orange
banana
apple
apple 3
banana 2
orange 1
</p>