Counting repeated words in a text

Go Easy maps

Task «Counting repeated words in a text»

Write a program that reads a line of text and counts the number of occurrences of each word in that line. Words are separated by spaces. Letter case is ignored (words in different cases are considered the same). Output the words and their count in alphabetical order. Constraints: the length of the line does not exceed 1000 characters, the number of unique words is no more than 100.

Input Format

One line of text consisting of words separated by spaces. The string may contain punctuation marks, which are not considered part of the words.

Output Format

For each unique word, output it and the number of occurrences separated by a space. Each pair is printed on a new line. Words are output in alphabetical order.

Examples

Example 1

INPUT
Hello world hello World
OUTPUT
hello 2 world 2

Example 2

INPUT
Go is fun go programming
OUTPUT
fun 1 go 2 is 1 programming 1

Example 3

INPUT
one two three four five six seven eight nine ten
OUTPUT
eight 1 five 1 four 1 nine 1 one 1 seven 1 six 1 ten 1 three 1 two 1
main.go