#C4353. Repeated Words Finder
Repeated Words Finder
Repeated Words Finder
You are given a text string that may contain letters, digits, punctuation, and spaces. Your task is to find all the words that appear more than once in the input, ignoring case differences. Words are defined as contiguous sequences of alphanumeric characters and underscores, i.e. they match the regular expression (\texttt{\b\w+\b}). The repeated words should be output in the order of their first occurrence in the text, separated by a single space.
For example, if the input is:
This is a test. This test is only a test.
Then the output should be:
this is a test
Note: When counting repeated words, comparison is case-insensitive (i.e. Test
and test
are considered the same).
inputFormat
A single line of text is provided via standard input. The text may contain punctuation, spaces, and a mix of uppercase and lowercase letters.
outputFormat
Output a single line to standard output containing the repeated words separated by a single space. If no word is repeated, output an empty line.## sample
This is a test. This test is only a test.
this is a test