Skip to content

Instantly share code, notes, and snippets.

@tonkatsu7
Created July 12, 2018 14:18
Show Gist options
  • Save tonkatsu7/a1a17c8a03353a90edaf5a56e8539537 to your computer and use it in GitHub Desktop.
Save tonkatsu7/a1a17c8a03353a90edaf5a56e8539537 to your computer and use it in GitHub Desktop.
Coder Byte challenge Vowel Count
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