#C12332. Summary Sentence Generation

    ID: 41748 Type: Default 1000ms 256MiB

Summary Sentence Generation

Summary Sentence Generation

You are given N sentences. Your task is to generate a summary sentence by processing each given sentence as follows:

  • Extract the first word of each sentence.
  • If the first word begins with a digit, discard that sentence.
  • If the first word starts with a vowel (i.e. one of \(\{a, e, i, o, u, A, E, I, O, U\}\)), include that word twice in the summary.
  • Otherwise, include the word once.

The summary sentence is constructed by concatenating the selected words in order, separated by a single space. If no words are selected, output an empty string.

inputFormat

The input is given via standard input (stdin) and has the following format:

N
sentence_1
sentence_2
...
sentence_N

Where N is an integer representing the number of sentences and each sentence_i is a string.

outputFormat

Output the summary sentence to standard output (stdout). The words in the summary sentence must be separated by a single space. If no words are selected, print an empty string.

## sample
5
Alpha beta
3rd place
elephant tricks
untold stories
234 is the start
Alpha Alpha elephant elephant untold untold