#P3966. Word Frequency Counter

    ID: 17214 Type: Default 1000ms 256MiB

Word Frequency Counter

Word Frequency Counter

Given a paper consisting of many words, count the number of occurrences for each distinct word. The order of output should follow the order in which each word first appears.

inputFormat

The input consists of a single line containing space-separated words.

outputFormat

For each distinct word, output the word followed by a space and its frequency on a new line, preserving the order of first appearance.

sample

hello world hello
hello 2

world 1

</p>