#C3094. Most Frequent Word
Most Frequent Word
Most Frequent Word
Given a text, your task is to identify the most frequently occurring word. A word is defined as a sequence of alphabetic characters (i.e. letters A-Z and a-z). The matching is case-insensitive, so "Hello" and "hello" are considered the same word.
Punctuation, numbers, and other non-alphabetic characters should be ignored. In case of a tie (i.e. multiple words occur the same maximum number of times), the word that appears first in the text is chosen.
The output should be the most frequent word in lowercase. If there is no valid word in the input, output an empty string.
inputFormat
A single line of text which may contain multiple words, punctuation, numbers, etc. The input is taken from standard input (stdin).
outputFormat
Print the most frequent word in lowercase to standard output (stdout). If no valid word exists, print an empty string.## sample
Hello
hello