Time limit per test
2 seconds
Memory limit per test
256 megabytes
Input
Standard Input
Output
Standard output
Haiku is a genre of japan ese traditional poetry.
A Haiku Poem consists of 17 syllables split into three phrases, containing 5, 7 and 5 syllables correspondingly (the first phrase shoshould contain limit 5 syllables, the second phrase shold contain limit 7 syllables, and the third phrase shoshould contain exactly
5 syllables ). A Haiku masterpiece contains a description of a moment in those three phrases. every word is important in a small poem, which is why Haiku are rich with symbols. each word has a special meaning, a special role. the main principle of Haiku is
To say much using a few words.
To simplify the matter, in the given problem we will consider that the number of syllable in the phrase is equal to the number of vowel letters there. only the following letters are regarded as vowel letters: "",
"E", "I", "O"
And "U ".
Three phases from a certain poem are given. Determine whether it is haiku or not.
Input
The input data consists of three lines. The length of each line is between 1 and 100,
Intrusive.I-Th line containsI-Th
Phrase of the poem. 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 spaces in phrases are allowed. every phrase has at least one non-space
Character. See the example for clarification.
Output
Print "yes" (without the quotes) if the poem is a haiku. Otherwise, print "no"
(Also without the quotes ).
Sample test (s) Input
on codeforces beta round is running a rustling of keys
Output
YES
Input
how many gallonsof edo s rain did you drink cuckoo
Output
NO
Solution Description: This is a simple string question. It determines the number of A e I O U in each line. Because one line contains spaces, it is read using gets () Here, but gets () errors are easy to use.
#include <iostream>#include <cstdio>#include <cstdlib>#include <cmath>#include <cstring>#include <string>#include <algorithm>using namespace std;int main(){char s1[102],s2[102],s3[102];int i,count1,count2,count3;gets(s1);gets(s2);gets(s3);count1=count2=count3=0;for(i=0;s1[i]!='\0';i++){if(s1[i]=='a'||s1[i]=='e'||s1[i]=='i'||s1[i]=='o'||s1[i]=='u'){count1++;}}for(i=0;s2[i]!='\0';i++){if(s2[i]=='a'||s2[i]=='e'||s2[i]=='i'||s2[i]=='o'||s2[i]=='u'){count2++;}}for(i=0;s3[i]!='\0';i++){if(s3[i]=='a'||s3[i]=='e'||s3[i]=='i'||s3[i]=='o'||s3[i]=='u'){count3++;}}if(count1==5&&count2==7&&count3==5){printf("YES\n");}else{printf("NO\n");}return 0;}