public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String input = null;
        int[] count = new int[VOWELS.length];
        int y = 0;
        try {
            System.out.print("Enter a string to check for vowels: ");
            input = scan.nextLine().toLowerCase();
        } finally {
            scan.close();
        }

        for (int i = 0; i < input.length(); i++) {
            try {
            if (isVowel(input, i, 0)) {
                char cur = input.charAt(i);
                if (cur != 'y') {
                    count[inList(VOWELS, cur)] += 1;
                } else {
                    y += 1;
                }
            }
            } catch (java.io.IOException err) {
                System.out.println(err.getMessage() + " Ignoring...");
            }
        }

        int vowelCount = y;
        for (int i=0; i<VOWELS.length; i++) {
            System.out.printf("%s: %d\n", VOWELS[i], count[i]);
            vowelCount += count[i];
        }
        System.out.println("y: " + y);
        System.out.println("spaces: " + (input.length() - input.replaceAll("\\s", "").length()));
        System.out.println("consonants: " + (input.length() - input.replaceAll("[a-z]", "").length() - vowelCount));
        System.out.println("punctuation: " + (input.replaceAll("[a-z0-9\\s]", "").length()));
    }