小明对类似于 hello 这种单词非常感兴趣,这种单词可以正好分为四段,第一段由一个或多个辅音字母组成,第二段由一个或多个元音字母组成,第三段由一个或多个辅音字母组成,第四段由一个或多个元音字母组成。
给定一个单词,请判断这个单词是否也是这种单词,如果是请输出yes,否则请输出no。
元音字母包括 a, e, i, o, u,共五个,其他均为辅音字母。
输入格式
输入一行,包含一个单词,单词中只包含小写英文字母。
输出格式
输出答案,或者为yes,或者为no。
样例输入
lanqiao
样例输出
yes
样例输入
world
样例输出
no
评测用例规模与约定
对于所有评测用例,单词中的字母个数不超过100。
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String word = scanner.nextLine();
String vowels = "aeiou";
String consonants = "bcdfghjklmnpqrstvwxyz";
int index = 0;
int aa = 0;
int bb = 0;
int cc = 0;
int dd = 0;
// 第一段辅音字母
while (index < word.length() && consonants.indexOf(word.charAt(index)) != -1) {
index++;
aa=1;
}
// 第二段元音字母
while (index < word.length() && vowels.indexOf(word.charAt(index)) != -1) {
index++;
bb=1;
}
// 第三段辅音字母
while (index < word.length() && consonants.indexOf(word.charAt(index)) != -1) {
index++;
cc=1;
}
// 第四段元音字母
while (index < word.length() && vowels.indexOf(word.charAt(index)) != -1) {
index++;
dd=1;
}
if (aa == 1 && bb == 1 && cc == 1 && dd == 1 && index == word.length()) {
System.out.println("yes");
} else {
System.out.println("no");
}
scanner.close();
}