for String a = "sefeg." console output:
e e
s f g .
package com.codegym.task.task09.task0923;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/*
Vowels and consonants
*/
public class Solution {
public static boolean a = false;
public static char[] vowels = new char[]{'a', 'e', 'i', 'o', 'u'};
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
if(!a){ String s = reader.readLine();
char[] a = s.toCharArray();
for(int i = 0; i<a.length; i++){
if(isVowel(a[i])){
System.out.print(a[i]);
System.out.print(" ");}
}
System.out.println();
for(int i = 0; i<a.length; i++){
if(!isVowel(a[i])){
System.out.print(a[i]);
System.out.print(" ");}}
}
else {
String a = "sefeg";
char []d = a.toCharArray();
for(int i =0; i < d.length; i++){
if(isVowel(d[i])){
System.out.print(d[i]);
System.out.print(" ");
}
}
System.out.println();
for(int i =0; i < d.length; i++){
if(!isVowel(d[i])){
System.out.print(d[i]);
System.out.print(" ");
}
}
}
// write your code here
}
// The method checks whether a letter is a vowel
public static boolean isVowel(char c) {
c = Character.toLowerCase(c); // Convert to lowercase
for (char d : vowels) // Look for vowels in the array
{
if (c == d)
return true;
}
return false;
}
}