题意:输入一串字符,判断每一位辅音字母后面是否都有一位元音字母,n是例外的。如果满足每位辅音字母都有元音,就输出YES,否则就输出NO
题解:模拟
c++:
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
for(int i=0; i<s.size(); i++)
if(strchr("aeioun",s[i])==NULL and strchr("aeiou",s[i+1])==NULL or strchr("aeioun",s[s.size()-1])==NULL)
{
printf("NO");
return 0;
}
printf("YES");
return 0;
}
python:
s=input()
a="aeiou"
for i in s:
if i not in a and i!="n":
if s[-1] not in "aeioun"or s[s.index(i)+1] not in a:
print("NO")
exit()
print("YES")