#K78652. Paragraph with Highest Unique Words
Paragraph with Highest Unique Words
Paragraph with Highest Unique Words
You are given a text document consisting of several paragraphs. Your task is to determine the paragraph that contains the highest number of unique words. A word is defined as any contiguous sequence of non-space characters and is considered in a case-insensitive manner (i.e., Word and word are the same). Words can be separated by spaces, punctuation marks, or line breaks.
If multiple paragraphs have the same maximum count of unique words, output the paragraph that appears first (1-indexed).
For example, if the input is:
3 This is the first paragraph. Here is the second paragraph, which is slightly longer than the first. The third paragraph is here.
Then the output should be 2 because the second paragraph contains the most unique words.
No additional formulas are required, but note that if needed, mathematical expressions should be formatted in LaTeX (e.g., \(a^2+b^2=c^2\)).
inputFormat
The first line contains an integer \(T\), the number of paragraphs. The following \(T\) lines each contain a paragraph of text.
outputFormat
Output a single integer, which is the 1-based index of the paragraph that has the highest number of unique words.
## sample3
This is the first paragraph.
Here is the second paragraph, which is slightly longer than the first.
The third paragraph is here.
2
</p>