zoukankan      html  css  js  c++  java
  • Romaji (CodeForces

    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
    ",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
  • 相关阅读:
    2011年03月28日
    如何响应UIScrollView的touchesBegan和touchesEnd消息
    使用Git在Mac和Windows系统之间进行同步数据
    ActionScript 3.0 编程 中文版PDF下载地址
    WIN7 英文 语言包(KB972813)/多国语言包下载(转)
    如何根据内容和字体调整UILabel的大小
    xcode 快捷键(转)
    VMware, Win7, Mac系统之间使用Git版本控制器的解决方案
    iOS 开发教程资源列表(转载)
    取消UITableViewCell高亮颜色
  • 原文地址:https://www.cnblogs.com/baiyi-destroyer/p/9734957.html
Copyright © 2011-2022 走看看