2 shunfurh shunfurh 于 2017.09.18 11:11 提问

Haiku Review

Haiku is an ancient form of Japanese poetry. A haiku is a three-line poem with seventeen syllables, where the first line must contain five syllables, the second line must contain seven syllables, and the third line must contain five syllables. The lines do not have to rhyme. Here is an example, where slashes separate the lines:
Computer programs/The bugs try to eat my code/I must not let them.

You must write a program that will review a haiku and check that each line contains the correct number of syllables.


The input contains one or more lines, each of which contains a single haiku. A haiku will contain at least three words, and words will be separated by either a single space or a slash (/'). Slashes also separate the three lines of a haiku, so each haiku will contain exactly two slashes. (The three lines of the haiku will be contained within one physical line of the file.) A haiku will contain only lowercase letters (a'-z'), forward slashes (/'), and spaces, and will be no more than 200 characters long (not counting the end-of-line characters).

The haiku `e/o/i' signals the end of the input.

Each haiku is guaranteed to contain three lines, and each line will contain at least one word. Your job is to determine whether each line has the correct number of syllables (5/7/5). For the purposes of this problem, every contiguous sequence of one or more vowels counts as one syllable, where the vowels are a, e, i, o, u, and y. Every word will contain at least one syllable. (Note that this method of counting syllables does not always agree with English conventions. In the second example below, your program must consider the word code' to have two syllables because theo' and the e' are not consecutive. However, in English thee' is silent and so `code' actually has only one syllable.)


For each haiku, output a single line that contains 1' if the first line has the wrong number of syllables,2' if the second line has the wrong number of syllables, 3' if the third line has the wrong number of syllables, orY' if all three lines have the correct number of syllables. If the haiku is not correct, you must output the number of the first line that has the wrong number of syllables.

Sample Input

happy purple frog/eating bugs in the marshes/get indigestion
computer programs/the bugs try to eat my code/i will not let them
a e i o u/this is seven syllables/a e i o u y

Sample Output



caozhy   Ds   Rxr 2017.10.02 23:46
Csdn user default icon
ZOJ 1713 HaiKu Review
查找每段字符串中a e i o u y 的个数。 注意: 连续的两个只算一个 #include #include int main() {  int i,j,count[3];  char s[200];     while(gets(s))     {   memset(count,0,sizeof(count));      if(strcmp(s,"e/o/i")==0
poj 1566 Haiku Review
/* 就是找由/分割的三句话中syllables(不连续的a,e,i,o,u,y算一个)的数量 若符合给出的5:7:5,输出Y;否则输出第一个不符合的句子的号码 */ #include #include char s[250]; int a[3],n; int ha(char
ZOJ1713 Haiku Review
又是一把过啊,特此纪念下~  字符串指针和string变量的对应- -  ╮(╯▽╰)╭学艺不精。。感觉得重新学一遍C++ #include #include using namespace std; bool isVowel(char ch) { return (ch=='a'||ch=='o'||ch=='e'||ch=='i'||ch=='u'||ch=='y'); } int
zoj 1713 Haiku Review
水题,但是我从别人的博客那里学来了新的读入方式,可以简化操作 #include using namespace std; int is(char c) { switch (c) { case 'a':return 1; case 'e':return 1; case 'i':return 1; case 'o':r
ZOJ 1713 Haiku Review
<br />Haiku是一种诗的形式,三行,按要求每行元音数目为5,7,5,每行用/隔开,都符合要求输出 Y,否则输出第一个不符合要求的,水题。<br /> <br />值得一提的是我用的一句很省事。<br />scanf("%[^'/']",a);<br />把不是斜杠的放到a中,不用再麻烦半天写一堆条件了。<br />本来想找关于“%[]”的知识,百度google都没收录这个,不想再在输入输出网页中找了。<br />还有%[^/n]表示把换行前的都放入字符串中。。<br /> <br />#includ
UVa 576 - Haiku Review
題目:給你三個句子,判斷三個句子中不連續的元音字母(包括y)出現的次數是否為5,7,5。 分析:簡單題。直接求解即可。 說明:╮(╯▽╰)╭。 #include #include int maps[256]; int size[3]; char buf[202]; int main() { memset(maps, 0, sizeof(maps)); maps['a'] =
zoj1713 Haiku Review
Haiku Review Time Limit: 2000MS   Memory Limit: 65536KB   64bit IO Format: %lld & %llu Submit Status Description Haiku is an ancient form of Japanese poetry. A haiku is a
A. Haiku
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Haiku is a genre of Japanese traditional poetry. A haiku poem
ARC#058F Iroha Loves Strings(贪心+字符串处理+dp预处理)
题面在这里 这题网上找不到题解啊。。于是我就自己对着某大佬的ac代码看了inf小时后终于(假装)懂了。。 题意 小C有NNN个字符串s1,s2,s3,...,sNs1,s2,s3,...,sNs_1, s_2, s_3, ..., s_N,并且他准备选择一些字符串顺次连接起来。问所有能得到的字符串中长度为KKK的字典序最小的。N≤2000,K≤104N≤2000,K≤104N ≤ 200...
Atcoder Regular 058 E - 和風いろはちゃん / Iroha and Haiku - 状压
题目大意:问有多少长度为N的数列{aN},满足每个数字权值在[1,10]中,并且不存在1 #include #include #include #define lint long long #define LOG 17 #define maxK 10 #define V 1 #define N 42 #define mod 1000000007 using namespace std; inli