#C13829. Word Counter

    ID: 43410 Type: Default 1000ms 256MiB

Word Counter

Word Counter

You are given a string that may contain letters, numbers, spaces, and punctuation marks. Your task is to count the occurrences of each distinct word in the string. In this problem, words are defined as sequences of alphanumeric characters. You should convert all letters to lowercase and remove any punctuation. The output should list each word along with its count in lexicographical order.

For example, given the input string:

( \texttt{Hello, hello world!} )

After converting to lowercase and removing punctuation, it becomes:

( \texttt{hello hello world} )

The output should be:

( \texttt{hello 2}\newline \texttt{world 1} )

Note: Your solution should read from standard input (stdin) and write to standard output (stdout). If the input is an empty string, no output should be produced.

inputFormat

The input consists of a single string which may span multiple lines. The string can contain letters, digits, spaces, and punctuation marks.

outputFormat

For each unique word in the input (after converting to lowercase and removing punctuation), output a line containing the word and its count separated by a single space. The words must be printed in lexicographical order.

## sample
Hello, hello world!
hello 2

world 1

</p>