package qsy;
import java.util.Scanner;
public class aeiou
{
public static void main(String[] args)
{String str;int left=0,right,counta=0,counte=0,counti=0,counto=0,countu=0,number,right1;
Scanner scan=new Scanner(System.in);
System.out.println("请输入一个字符串:");
str=scan.nextLine();System.out.println("您输入的字符串为:"+str);
scan.close();
right=str.length()-1;
right1=str.length();
while(left<=right)
{ if (str.charAt(left)=='a')
counta++;
if (str.charAt(left)=='e')
counte++;
if (str.charAt(left)=='i')
counti++;
if (str.charAt(left)=='o')
counto++;
if (str.charAt(left)=='u')
countu++;
left++;
}
number=right1-counta-counte-counti-counto-countu;
System.out.println("次文本中共有的a的个数为:"+counta);
System.out.println("次文本中共有的e的个数为:"+counte);
System.out.println("次文本中共有的i的个数为:"+counti);
System.out.println("次文本中共有的o的个数为:"+counto);
System.out.println("次文本中共有的u的个数为:"+countu);
System.out.println("次文本中共有的非元音字母的个数为:"+number);
}
}
//记住当用所有字符个数减去元音数的时候,直接求字符串长度(不能减1)