#C13228. Word Frequency Counter Ignoring Stopwords

    ID: 42743 Type: Default 1000ms 256MiB

Word Frequency Counter Ignoring Stopwords

Word Frequency Counter Ignoring Stopwords

You are given a block of text through standard input. Your task is to count the frequency of each word that is not a common stopword. The common stopwords to ignore are given by the set ({a, and, the, is, in, it, of, to, for, with, on, at, by, an, be, this, that, are, or, from, was}). Only consider sequences of alphanumeric characters as words, ignoring punctuation. Treat uppercase and lowercase letters as the same (i.e., convert everything to lowercase). Finally, output the word frequencies as a JSON formatted dictionary to standard output.

inputFormat

The input consists of a block of text provided via standard input (stdin). There are no strict constraints on the size of the text.

outputFormat

The output should be a single JSON formatted dictionary printed to standard output (stdout). The dictionary keys are the words (as strings) and the values are their respective frequency counts (as integers), considering only the words that are not stopwords.## sample

This is a test. This test is only a test.
{"test": 3, "only": 1}