Problems
Write a program that takes an arbitrary sentence as input, splits it into words, and counts the occurrences of each word.
Conditions
The input string can contain any characters, including uppercase and lowercase letters, spaces, commas, etc.
Words are separated by spaces.
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
Tag
Source
JUNGOL - comkiwer