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
  • 相关阅读:
    koa 放置 前台打包dist 目录
    tomcat startup.bat 包含springboot的输出 里面乱码的解决方案
    base64 转文件上传
    4时4态 加被动 例句:I will have been being done
    软件推荐 Notable / 现改用 Vnote 了
    [win10] 开始-设置 / 右键-显示设置 / 右键个性化 等都不好使了。。 ms-settings:display
    viewui tree 自定义化(源码copy出来改动)#添加 获取selected 解决方案
    idea 暂存 Stash Changes Git/Repository/Stash Changes 恢复暂存 UnStash Changes
    vm 虚拟机总是蓝屏 移除打印机和声卡 移除这俩硬件 (大文件用飞秋传输)
    docker中mysql 汉字乱码,显示问号
  • 原文地址:https://www.cnblogs.com/baiyi-destroyer/p/9734957.html
Copyright © 2011-2022 走看看