Vitya has just started learning Berlanese language. It is known that Berlanese uses the Latin alphabet. Vowel letters are "a", "o", "u", "i", and "e". Other letters are consonant.
In Berlanese, there has to be a vowel after every consonant, but there can be any letter after any vowel. The only exception is a consonant "n"; after this letter, there can be any letter (not only a vowel) or there can be no letter at all. For example, the words "harakiri", "yupie", "man", and "nbo" are Berlanese while the words "horse", "king", "my", and "nz" are not.
Help Vitya find out if a word ss is Berlanese.
Input
The first line of the input contains the string ss consisting of |s||s| (1≤|s|≤1001≤|s|≤100) lowercase Latin letters.
Output
Print "YES" (without quotes) if there is a vowel after every consonant except "n", otherwise print "NO".
You can print each letter in any case (upper or lower).
Examples
sumimasen
YES
ninja
YES
codeforces
NO
Note
In the first and second samples, a vowel goes after each consonant except "n", so the word is Berlanese.
In the third sample, the consonant "c" goes after the consonant "r", and the consonant "s" stands on the end, so the word is not Berlanese.
题解:大水题,可惜没看清题意wa了好多发,注意辅音后面紧跟元音如果跟n是输出NO的。

1 #include<iostream> 2 #include<cstdio> 3 #include<cstdlib> 4 #include<cstring> 5 #include<string> 6 #include<cmath> 7 #include<map> 8 #include<stack> 9 #include<vector> 10 #include<queue> 11 #include<set> 12 #include<algorithm> 13 #define max(a,b) (a>b?a:b) 14 #define min(a,b) (a<b?a:b) 15 #define swap(a,b) (a=a+b,b=a-b,a=a-b) 16 #define maxn 320007 17 #define N 100000000 18 #define INF 0x3f3f3f3f 19 #define mod 1000000009 20 #define e 2.718281828459045 21 #define eps 1.0e18 22 #define PI acos(-1) 23 #define lowbit(x) (x&(-x)) 24 #define read(x) scanf("%d",&x) 25 #define put(x) printf("%d\n",x) 26 #define memset(x,y) memset(x,y,sizeof(x)) 27 #define Debug(x) cout<<x<<" "<<endl 28 #define lson i << 1,l,m 29 #define rson i << 1 | 1,m + 1,r 30 #define ll long long 31 //std::ios::sync_with_stdio(false); 32 //cin.tie(NULL); 33 using namespace std; 34 35 char a[111]; 36 int b[111]; 37 int main() 38 { 39 cin>>a; 40 int l=strlen(a); 41 for(int i=0;i<l;i++) 42 { 43 if(a[i]!='a'&&a[i]!='e'&&a[i]!='i'&&a[i]!='o'&&a[i]!='u') 44 b[a[i]-'a']++; 45 } 46 47 int i,flag=0; 48 for(i=0;i<l-1;i++) 49 { 50 if(b[a[i]-'a']&&a[i]!='n'&&b[a[i+1]-'a']) 51 { 52 flag=1; 53 //cout<<i<<endl; 54 } 55 } 56 if(!flag&&(!b[a[l-1]-'a']||a[i]=='n')) 57 cout<<"YES"<<endl; 58 else 59 cout<<"NO"<<endl; 60 return 0; 61 }
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET制作智能桌面机器人:结合BotSharp智能体框架开发语音交互
· 软件产品开发中常见的10个问题及处理方法
· .NET 原生驾驭 AI 新基建实战系列:向量数据库的应用与畅想
· 从问题排查到源码分析:ActiveMQ消费端频繁日志刷屏的秘密
· 一次Java后端服务间歇性响应慢的问题排查记录
· 互联网不景气了那就玩玩嵌入式吧,用纯.NET开发并制作一个智能桌面机器人(四):结合BotSharp
· 一个基于 .NET 开源免费的异地组网和内网穿透工具
· 《HelloGitHub》第 108 期
· Windows桌面应用自动更新解决方案SharpUpdater5发布
· 我的家庭实验室服务器集群硬件清单