how can i fulfill the 4th condition?
package com.codegym.task.task09.task0923;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
Vowels and consonants
*/
public class Solution {
public static char[] vowels = new char[]{'a', 'e', 'i', 'o', 'u'};
public static void main(String[] args) throws Exception {
BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Character> list = new ArrayList<Character>();
ArrayList<Character> v = new ArrayList<Character>();
ArrayList<Character> cn = new ArrayList<Character>();
ArrayList<Character> space = new ArrayList<Character>();
String word = rd.readLine();
for (int i=0;i<word.length(); i++){
if (word.equals(" ")){
space.add(word.charAt(i));
}
else {
list.add(word.charAt(i));}
}
for (int j=0;j<list.size();j++){
if (isVowel(list.get(j))){
v.add(list.get(j));
}
else {
cn.add(list.get(j));
}
}
for (char a : v){
System.out.print(a + " ");
}
System.out.println();
for (char b : cn){
System.out.print(b + " ");
}
// 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;
}
}