PRB2: Haiku // Beginner

 

A haiku is a genre of Japanese traditional poetry. A haiku poem consists of 17 syllables split into three phrases, containing 5, 7 and 5 syllables respectively. A haiku masterpiece contains a concise but vivid description of a moment in those three phrases. and haikus are rich with symbols. A haiku can say a lot using a few words. For simplification, in this problem we will define the number of syllables in the phrase to be the number of vowel letters there. Only these characters are vowel letters: "a", "e", "i", "o" and "u". Given a collection of 3-line poems, determine whether each of them is a haiku.

Input Format

The first line of input has a single integer, which is the number of test cases T . The next 3T lines of input has T poems. Each poem has 3 phrases, each of which lie on separate lines. Each phrase consists of one or more words, which are separated by one or more spaces. A word is a non-empty sequence of lowercase Latin letters. Leading and/or trailing whitespaces in phrases are allowed. Every phrase has at least one non-whitespace character.

Sample Input

2
in this website
there are many problems
to be answered
o vetus stagnum
   rana    de ripa salit
  ac   sonant     aquae

Output Format

The output should consist of T lines. The ith line should have either a "YES" (without the quotes), if the corresponding poem is a haiku, or a "NO" , if the corresponding poem is not a haiku.

Sample Output

YES
NO

Show Hints


You must be logged in to submit a solution.