The output is correct but verification fails.
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 {
InputStreamReader inputStreamReader = new InputStreamReader(System.in);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String s = bufferedReader.readLine().replaceAll("\\s", "");
ArrayList<Character> list = new ArrayList<Character>();
ArrayList<Character> list1 = new ArrayList<Character>();
char[] c = s.toCharArray();
for (int i = 0; i < s.length(); i++){
if (isVowel(c[i])){
list.add(c[i]);
}
else {
list1.add(c[i]);
}
}
for (int j = 0; j < list.size(); j++){
System.out.print(list.get(j) + " ");
}
System.out.println("");
for (int k = 0; k < list1.size() + 1; k++){
System.out.print(list1.get(k) + " ");
}
// 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;
}
}