#C5894. Count Long Strings Ignoring Case

    ID: 49593 Type: Default 1000ms 256MiB

Count Long Strings Ignoring Case

Count Long Strings Ignoring Case

Given a list of strings, your task is to count the frequency of each string with more than three characters. The comparison should be case-insensitive, meaning that letters with different cases should be treated as the same character. Only strings with a length greater than 3 are considered. Print each distinct string in lowercase along with its count, with each pair on a new line and the strings sorted in lexicographical order.

Formally, let \( S = \{s_1, s_2, \dots, s_n\} \) be the set of input strings. For each string \( s_i \) such that \(|s_i| > 3\), define \( t_i = \text{lowercase}(s_i) \). You need to compute the frequency of each distinct \( t_i \) and output the result in increasing order of \( t_i \).

inputFormat

The input is given via standard input (stdin) and consists of:

  • The first line contains a single integer \( N \), representing the number of strings.
  • Each of the following \( N \) lines contains one non-empty string.

outputFormat

Output the results to standard output (stdout). For each distinct string (converted to lowercase) that has more than three characters, print a line containing the string and its frequency separated by a space. The output lines must be sorted in lexicographical order by the string. If no string meets the criteria, output nothing.

## sample
6
Apple
BANANA
apple
Dog
Cat
elephant
apple 2

banana 1 elephant 1

</p>