class Solution {public boolean isValid(String word) {if(word.length()<3){return false;}int countV=0,countC=0;//分别统计原音和辅音for(int i=0;i<word.length();i++){if(Character.isLetterOrDigit(word.charAt(i))){if(word.charAt(i)=='a'||word.charAt(i)=='e'||word.charAt(i)=='i'||word.charAt(i)=='o'||word.charAt(i)=='u'||word.charAt(i)=='A'||word.charAt(i)=='E'||word.charAt(i)=='I'||word.charAt(i)=='O'||word.charAt(i)=='U'){countC++;}else if(Character.isLetter(word.charAt(i))){countV++;}}else{return false;}}return countC>0&&countV>0;}
}
class Solution(object):def isValid(self, word):if len(word)<3:return FalsecountV,countC=0,0;#分别统计原音和辅音for i in range(len(word)):if word[i].isdigit() or word[i].isalpha():if word[i]=="a" or word[i]=="e" or word[i]=="i" or word[i]=='o' or word[i]=='u' or word[i]=='A' or word[i]=='E' or word[i]=='I' or word[i]=='O' or word[i]=='U':countC+=1elif word[i].isalpha():countV+=1else:return Falsereturn countC>0 and countV>0