-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path7.cpp
95 lines (90 loc) · 1.45 KB
/
7.cpp
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include <bits/stdc++.h>
#define endl '\n'
#define eat cin
#define moo cout
#define int long long
using namespace std;
int T, N;
vector<string> bad;
string S;
string vw[] = {"a", "e", "i", "o", "u"};
char lts[] = {'a', 'e', 'i', 'o', 'u',
'm', 'n', 'p', 't', 'k', 's',
'w', 'j', 'l'};
bool f(string x){
if(S.find(x) != string::npos){
return 1;
}
return 0;
}
bool isV(char x){
for(int i = 0; i < 14; i++){
if(lts[i] == x){
if(i < 5) return 1;
else return 0;
}
}
assert(false);
return 0;
}
int32_t main(){
eat.tie(0) -> sync_with_stdio(0);
eat >> T;
bad.push_back("wu");
bad.push_back("wo");
bad.push_back("ji");
bad.push_back("ti");
bad.push_back("nn");
bad.push_back("nm");
for(int i = 0; i < 5; i++){
for(int j = 0; j < 5; j++){
bad.push_back(vw[i] + vw[j]);
}
}
while(T--){
eat >> S;
N = S.size();
bool ok = 1;
for(char i : S){
bool cf = 0;
for(int j = 0; j < 14; j++){
if(i == lts[j]) cf = 1;
}
if(!cf) ok = 0;
}
if(!ok){
moo << "ike" << endl;
continue;
}
for(string i : bad){
if(f(i)) ok = 0;
}
if(!ok){
moo << "ike" << endl;
continue;
}
int stg = 0;
for(int i = 0; i < N; i++){
bool vt = isV(S[i]);
if(!vt){
if(stg == 1){
ok = 0;
break;
}
if(stg == 2){
if(S[i] != 'n'){
stg = 0;
}
}
stg = (stg + 1) % 3;
}else{
stg = 2;
}
}
if(ok && stg != 1){
moo << "pona" << endl;
}else{
moo << "ike" << endl;
}
}
}