1String str = "hello";
2String vowels = "aeiou";
3
4for(char c : str) if(vowels.contains(c)) System.out.println(c + "");
1import java.util.Scanner;
2import java.util.*;
3
4class Test{
5
6 public static boolean isVowel(char ch){
7 if(ch == 'A' || ch == 'a' || ch == 'E' || ch == 'e' || ch == 'i' || ch == 'I' || ch == 'o' || ch == 'O' || ch == 'u' || ch == 'U'){
8 return true;
9 }
10 return false;
11 }
12
13 public static void main(String args[]){
14
15 Scanner scan = new Scanner(System.in);
16 List<String> arr = new ArrayList<String>();
17 String str = scan.nextLine();
18 String words[] = str.split("\\s");
19
20 for(String k: words){
21 boolean flag = false;
22 boolean f1 = true;
23 boolean f2 = true;
24 if(k.length()<=2){
25 continue;
26 }
27 for(int i = 0 ; i < k.length() ; i = i + 2){
28 if(isVowel(k.charAt(i))==false){
29 f1 = false;
30 break;
31 }
32 }
33 for(int i = 1 ; i < k.length() ; i = i + 2){
34 if(isVowel(k.charAt(i))==false){
35 f2 = false;
36 break;
37 }
38 }
39 if(f1 == true || f2 == true){
40 flag = true;
41 }
42 if(flag == true){
43 arr.add(k);
44 }
45 }
46 if(arr.size()==0){
47 System.out.print(-1);
48 }
49 else{
50 for(int i = 0 ; i < arr.size() ; i++)
51 {
52 System.out.print(arr.get(i) + " ");
53 }
54 }
55 scan.close();
56 }
57
58}