#K12691. Unique Words Extraction

    ID: 23747 Type: Default 1000ms 256MiB

Unique Words Extraction

Unique Words Extraction

You are given a paragraph that may contain letters, digits, spaces, and punctuation marks. Your task is to remove all punctuation, convert all letters to lowercase, and then extract the unique words in the order they appear. Note that punctuation is any character that is not a letter or digit. For example, given the paragraph:

\(\texttt{This is a simple example. A very simple example.}\)

the unique words extracted should be: this, is, a, simple, example, very.

You need to process multiple test cases. Each test case consists of one paragraph. For each test case, first output the number of unique words, followed by the unique words on separate lines in the order they appear in the text.

inputFormat

The first line contains an integer \(T\) \((1 \leq T \leq 100)\) representing the number of test cases. Each of the following \(T\) lines contains a paragraph.

outputFormat

For each test case, output the number of unique words found in the paragraph on a single line. Then output each unique word on a new line in the order they appear.

## sample
3
This is a simple example. A very simple example.
A Test case, another test case.
Hello, hello; world! World?
6

this is a simple example very 4 a test case another 2 hello world

</p>