-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path1566.cc
59 lines (53 loc) · 1.41 KB
/
1566.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//Name: Haiku Review
//Level: 1
//Category: 文字列,やるだけ
//Note:
/*
* 先頭から母音を数えていくだけ.
* /がきたときは母音の連続判定がリセットされることに注意.
*/
#include <iostream>
#include <string>
using namespace std;
int main() {
while(true) {
string s;
getline(cin, s);
if(s == "e/o/i") break;
char ans = 'Y';
int cnt = 0;
int phase = 0;
bool prev_is_syllable = false;
for(int i = 0; i <= s.size(); ++i) {
if(i == s.size() || s[i] == '/') {
if(phase == 1) {
if(cnt != 7) {
ans = '2';
break;
}
}
else {
if(cnt != 5) {
ans = '0'+phase+1;
break;
}
}
++phase;
cnt = 0;
prev_is_syllable = false;
if(i == s.size()) break;
}
else {
if(string("aeiouy").find(s[i]) != string::npos) {
if(!prev_is_syllable) ++cnt;
prev_is_syllable = true;
}
else {
prev_is_syllable = false;
}
}
}
cout << ans << endl;
}
return 0;
}