Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
903
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. package com.company;
  2. import java.util.Scanner;
  3. public class Main {
  4. static int count (String input){
  5. String[] text = input.split("");
  6. int counter =0;
  7. for (int i = 0; i < text.length; i++) {
  8. if(text[i].equals("a")||text[i].equals("A")){
  9. counter++;
  10. }else if(text[i].equals("e")||text[i].equals("E")){
  11. counter++;
  12. }else if(text[i].equals("i")||text[i].equals("I")){
  13. counter++;
  14. }else if(text[i].equals("o")||text[i].equals("O")){
  15. counter++;
  16. }else if(text[i].equals("u")||text[i].equals("U")){
  17. counter++;
  18. }else if(text[i].equals("y")||text[i].equals("Y")){
  19. counter++;
  20. }
  21. }
  22. return counter;
  23. }
  24. public static void main (String[]args){
  25. Scanner scanner = new Scanner(System.in);
  26. String input = scanner.nextLine();
  27. System.out.println(count(input));
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement