无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

CF1008A - Romaji

2023-06-24 11:22 作者:您是打尖兒還是住店呢  | 我要投稿

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 s

?is Berlanese.


Input

The first line of the input contains the string s

?consisting of |s|

?(1≤|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).

------------------------------

本來是一道簡單題目,我卻想復(fù)雜了。。。

1:判斷當前是否是元音;

2:如果不是元音的話,繼續(xù)判斷;

3:如果是n,continue;

4:如果下一位還是輔音,則輸出NO,程序退出,(條件是當前的所以不能是最后一位)

下面是代碼:

import java.util.HashSet;

import java.util.Scanner;

import java.util.Set;


public class A1008 {

? ? public static void main(String[] args) {

? ? ? ? Scanner sc=new Scanner(System.in);

? ? ? ? String s=sc.next();

? ? ? ? sc.close();

? ? ? ? Set<Character>v=new HashSet<>();

? ? ? ? v.add('a');

? ? ? ? v.add('e');

? ? ? ? v.add('i');

? ? ? ? v.add('o');

? ? ? ? v.add('u');

? ? ? ? char[]cs=s.toCharArray();

? ? ? ? for (int i = 0; i < cs.length; i++) {

? ? ? ? ? ? if(!v.contains(cs[i])){

? ? ? ? ? ? ? ? if(cs[i]=='n'){

? ? ? ? ? ? ? ? ? ? continue;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? if(i==cs.length-1||!v.contains(cs[i+1])){

? ? ? ? ? ? ? ? ? ? System.out.println("NO");

? ? ? ? ? ? ? ? ? ? return;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? }

? ? ? ? System.out.println("YES");

? ? }

}



CF1008A - Romaji的評論 (共 條)

分享到微博請遵守國家法律
松桃| 浪卡子县| 神木县| 工布江达县| 安龙县| 油尖旺区| 祁连县| 满城县| 昌宁县| 淳安县| 永昌县| 柳江县| 阿拉善左旗| 濉溪县| 衡阳县| 合江县| 社会| 英吉沙县| 柞水县| 黔江区| 炎陵县| 颍上县| 土默特左旗| 介休市| 顺义区| 张掖市| 河源市| 烟台市| 四子王旗| 板桥市| 牡丹江市| 新乐市| 德保县| 苏尼特右旗| 驻马店市| 莱阳市| 双鸭山市| 应城市| 迭部县| 专栏| 平顶山市|