Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- class Main {
- public static void main(String[] args) {
- Scanner s = new Scanner(System.in);
- String str = s.nextLine();
- System.out.println( countVowels(str) );
- }
- public static int countVowels(String str){
- int counter = 0;
- for (int i=0 ; i< str.length(); i++){
- str = str.toLowerCase();
- char ch = str.charAt(i);
- if( ch == 'a'|| ch == 'e'|| ch == 'i' ||ch == 'o' ||ch == 'u'){
- counter++;
- }
- }
- return counter;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment