Repeated words P30170


Statement
 

pdf   zip

html

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 1 ≤ n ≤ 105, followed by n words.

Output

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

Public test cases
  • Input

    12 z z ab dddddd z z ab yy yy yy yy x
    2 c3po r2d2
    

    Output

    1 : 7
    2 : 2
    4 : 3
    
    1 : 8
    
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Java Python
    User solutions
    C++