class Ideone {
	public static void main (String[] args) {
	    String[] tests = {
            "Hi I have a dog named Patch",
            "I have a dog named ALPHA",
        };
        for (String str : tests) {
            str = str.replaceAll("(?i)^[^aeiou]*|[^aeiou]*$", "");
            System.out.println(str);
        }
	}
}