Romaji (CodeForces - 1008A )

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

Input
sumimasen
Output
YES
Input
ninja
Output
YES
Input
codeforces
Output
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 }
View Code

 

转载于:https://www.cnblogs.com/baiyi-destroyer/p/9734957.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值