#K15301. Reordering Book Titles

    ID: 24326 Type: Default 1000ms 256MiB

Reordering Book Titles

Reordering Book Titles

You are given a list of book titles. Your task is to reorder these titles such that the titles starting with a vowel (\(a,e,i,o,u\)) appear first in lexicographical order, followed by the titles starting with a consonant (also in lexicographical order).

Details:

  • Titles are compared in lexicographical (dictionary) order.
  • The first character check is case-insensitive.

For example, given the titles:

"silent spring"
"a tale of two cities"
"gone with the wind"
"the great gatsby"
"emma"

The reordered list would be:

"a tale of two cities"
"emma"
"gone with the wind"
"silent spring"
"the great gatsby"

inputFormat

The input is read from standard input (stdin) and consists of multiple lines:

  • The first line contains an integer \(n\), representing the number of book titles.
  • Each of the following \(n\) lines contains a single book title (a non-empty string).

outputFormat

Output the reordered list of book titles to standard output (stdout), each title on a separate line.

## sample
5
silent spring
a tale of two cities
gone with the wind
the great gatsby
emma
a tale of two cities

emma gone with the wind silent spring the great gatsby

</p>