Created
July 12, 2018 14:18
-
-
Save tonkatsu7/a1a17c8a03353a90edaf5a56e8539537 to your computer and use it in GitHub Desktop.
Coder Byte challenge Vowel Count
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.io.*; | |
class Main { | |
public static int VowelCount(String str) { | |
int cnt = 0; | |
for (char ch : str.toLowerCase().toCharArray()) { | |
switch (ch) { | |
case 'a': | |
case 'e': | |
case 'i': | |
case 'o': | |
case 'u': | |
cnt++; | |
break; | |
} | |
} | |
return cnt; | |
} | |
public static void main (String[] args) { | |
// keep this function call here | |
Scanner s = new Scanner(System.in); | |
System.out.print(VowelCount(s.nextLine())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment