Repeated words

Write a program that, given a sequence of words, computes how many characters have in total the words that appear once, how many characters have in total the words that appear twice, how many characters have in total the words that appear thrice, etc.

Input

Input consists of several cases. Each case begins with a number 1n1051 \le n \le 10^5, followed by nn words.

Output

For each case of the input and for each number xx of repetitions, print in a line the total number of characters (not counting repetitions) of the words that appear exactly xx times, If there is no word with xx repetitions, do not print anything for this xx. Print an empty line after every case.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T10:07:46.733Z

© Jutge.org, 2006–2026.
https://jutge.org