#K66967. Word Frequency Counter

    ID: 32538 Type: Default 1000ms 256MiB

Word Frequency Counter

Word Frequency Counter

You are given a block of text that may include letters, digits, punctuation, spaces, newlines, and tabs. Your goal is to count the frequency of each word, where a word is defined as a sequence of letters (a–z and A–Z), digits (0–9) and apostrophes ('). The matching is case‐insensitive; that is, uppercase and lowercase letters are treated the same. The output should be a JSON object (dictionary) that lists each word (in the order of its first appearance) as a key and its frequency as the value.

Note: Use the following regular expression to identify words in the text:
\( [a-zA-Z0-9']+ \)

Input: A text (possibly spanning multiple lines) read from standard input (stdin).

Output: A JSON formatted object printed to standard output (stdout), representing the word frequency counts with keys in order of their appearance. If no valid word is found, output an empty JSON object, {}.

inputFormat

The input is provided via standard input (stdin) and consists of a block of text. The text can include spaces, tabs, newlines, and punctuation.

outputFormat

The output should be printed to standard output (stdout) as a JSON object. Each key in the object is a word (in lowercase) and its corresponding value is the count of that word. The keys must appear in the order they first appear in the input.

## sample
{}