import java.util.Scanner;
public class JavaApplication81 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Input the string");
String as = s.nextLine();
int cons = 0;
int a = 0;
int e = 0;
int i = 0;
int o = 0;
int u = 0;
int space = 0;
int punc = 0;
char c;
int misc = 0;
String punctuation = ".!,?";
String consonants = "bcdfghjklmnpqrstvwxyz";
for (int k = 0; k < as.length(); k++){
c = as.charAt(k);
if (Character.isWhitespace(c)){
space ++;
}
else if (punctuation.indexOf(c) != -1){
punc++;
}
else if (consonants.indexOf(c) != -1){
cons++;
}
else if (c == 'a'){
a++;
}
else if(c == 'e'){
e++;
}
else if (c == 'i'){
i++;
}
else if (c == 'o'){
o++;
}
else if (c == 'u'){
u++;
}
else{
misc++;
}
}
System.out.println(a+" a's");
System.out.println(e+" e's");
System.out.println(i+" i's");
System.out.println(o+" o's");
System.out.println(u+" u's");
System.out.println(space+" spaces");
System.out.println(punc+" punctuations");
System.out.println(cons+" consonants");
System.out.println(misc+" misc. (uppercase vowels, etc.");
}
}
This is one example of how it could be done.