fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner sc=new Scanner(System.in);
  13. String str=sc.nextLine();
  14. int vow=0,dig=0,consonants=0;
  15. for(char ch:str.toCharArray())
  16. {
  17. if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u')
  18. {
  19. vow++;
  20. }
  21. else if(Character.isDigit(ch))
  22. {
  23. dig++;
  24. }
  25. else
  26. {
  27. consonants++;
  28. }
  29.  
  30. if(Character.isUpperCase(ch))
  31. ch=Character.toLowerCase(ch);
  32.  
  33. }
  34. System.out.println(vow+" "+dig+" "+consonants);
  35. System.out.println(str);
  36. // your code goes here
  37. }
  38. }
Success #stdin #stdout 0.28s 60864KB
stdin
GeeksforGeeks
stdout
5 0 8
GeeksforGeeks