Page not loading? Try clicking here.
Placeholder

#1516

Counts words 1s 32MB

Problems

Write a program that takes an arbitrary sentence as input, splits it into words, and counts the occurrences of each word.


Conditions

  1. The input string can contain any characters, including uppercase and lowercase letters, spaces, commas, etc.

  2. Words are separated by spaces.

  3. Each word includes all characters except spaces.


Input

An arbitrary sentence (length ≤ 200).

After one sentence is processed, the program continues to receive new sentences until the input "END" is received. (The number of sentences will not exceed 30.)


Output

For each sentence, print the frequency of each word in ascending ASCII order.


Example #1

I AM DOG DOG DOG DOG A AM I

I AM OLYMPIAD JUNGOL JUNGOL OLYMPIAD
END
A : 1

AM : 2
DOG : 4
I : 2
AM : 1
I : 1
JUNGOL : 2
OLYMPIAD : 2

Example #2

A C A A
2 2 2 2
2 3 2 3 2 2
END
A : 3
C : 1
2 : 4
2 : 4
3 : 2


Source

JUNGOL - comkiwer

You must sign in to write code.