Codeforces Round #497 (Div. 2)----A Romaji
程序员文章站
2022-06-04 08:23:02
...
每一个原音后面都要有一个辅音,那么便利一边字符串,每个检查一遍,如果不是原音,那么就检查下一位是不是原音,或者当前位是不是n即可,代码如下
#include <bits/stdc++.h>
using namespace std;
char line[10000];
int check(char s){
if ('A' <= s && s <= 'Z') {
s = s - 'A' + 'a';
}
if (s == 'a') {
return 1;
}else if (s == 'o'){
return 1;
}else if (s == 'u'){
return 1;
}else if (s == 'i'){
return 1;
}else if (s == 'e'){
return 1;
}
return 0;
}
int main(){
scanf("%s",line);
long long len = strlen(line);
int flag = 1;
for (int i=0; i<len; i++) {
if (!check(line[i])) {
if (!(check(line[i+1]) || line[i] == 'n' || line[i] == 'N')) {
flag = 0;
}
}
}
if (flag) {
cout << "YES" << endl;
}else{
cout << "NO" << endl;
}
return 0;
}
推荐阅读
-
Codeforces Round #655 (Div. 2) A. Omkar and Completion
-
Codeforces Round #656 (Div. 3)D. a-Good String(递归+dfs)
-
Codeforces Round #487 (Div. 2)
-
CodeForces 1324 - Codeforces Round #627 (Div. 3)
-
Codeforces Round #649 (Div. 2)-B. Most socially-distanced subsequence(思维)
-
Codeforces Round #649 (Div. 2) C-Ehab and Prefix MEXs
-
Educational Codeforces Round 71 (Rated for Div. 2)E. XOR Guessing
-
Codeforces Round #659 (Div. 2) A. Common Prefixes(字符串,思维)
-
Codeforces Round #610 (Div. 2)
-
Codeforces Round #670 (Div. 2)