import java.util.Scanner;

public class a3Problem1 {

    public static void main(String[] args) {
    	
    	Scanner in = new Scanner(System.in);
    	
    	System.out.print("Please feel free to enter anything: ");
    	String input = in.nextLine();
    	String alphaOnly = input.replaceAll("[^a-zA-Z]+","");
    	int vowelCount = 0;
    	
    	//a.
    	System.out.print("Upper case letters in the user input: ");
    	for (int i = 0; i < input.length(); i++) {
    		if (Character.isUpperCase(input.charAt(i))) {
    			System.out.print(input.charAt(i));
    		}
    	}
    	System.out.println();
    	
    	//b. The following for loop will print out literally every second letter, ignoring all special characters and spaces.
    	System.out.print("Every second letter in the user input: ");
    	for (int i = 1; i < alphaOnly.length(); i = i + 2) {
    		System.out.print(alphaOnly.charAt(i));
    	}
    	System.out.println();
    	
    	//c.
    	System.out.print("User input with all vowels replaced by an asterisk: ");
    	for (int i = 0; i < input.length(); i++) {
    		String vowelAst = input.substring(i, (i + 1));
    		switch (vowelAst) {
    			case "a": vowelAst = "*"; break;
    			case "e": vowelAst = "*"; break;
    			case "i": vowelAst = "*"; break;
    			case "o": vowelAst = "*"; break;
    			case "u": vowelAst = "*"; break;
    			case "A": vowelAst = "*"; break;
    			case "E": vowelAst = "*"; break;
    			case "I": vowelAst = "*"; break;
    			case "O": vowelAst = "*"; break;
    			case "U": vowelAst = "*"; break;
    		}
    		System.out.print(vowelAst);
    	}
    	System.out.println();
    	
    	//d.
    	System.out.print("Number of vowels in user input: ");
    	for (int i = 0; i < input.length(); i++) {
    		String vowel = input.substring(i, (i + 1));
    		switch (vowel) {
    			case "a": vowelCount++; break;
    			case "e": vowelCount++; break;
    			case "i": vowelCount++; break;
    			case "o": vowelCount++; break;
    			case "u": vowelCount++; break;
    			case "A": vowelCount++; break;
    			case "E": vowelCount++; break;
    			case "I": vowelCount++; break;
    			case "O": vowelCount++; break;
    			case "U": vowelCount++; break;
    		}
    	}
    	System.out.print(vowelCount);
    	System.out.println();
    	
    	//e.
    	System.out.print("Index positions of all vowels in user input: ");
    	for (int i = 0; i < input.length(); i++) {
    		String vowel = input.substring(i, (i + 1));
    		switch (vowel) {
    			case "a": System.out.print(i + " "); break;
    			case "e": System.out.print(i + " "); break;
    			case "i": System.out.print(i + " "); break;
    			case "o": System.out.print(i + " "); break;
    			case "u": System.out.print(i + " "); break;
    			case "A": System.out.print(i + " "); break;
    			case "E": System.out.print(i + " "); break;
    			case "I": System.out.print(i + " "); break;
    			case "O": System.out.print(i + " "); break;
    			case "U": System.out.print(i + " "); break;
    		}
    	}
    	
    }
    
}