Seriously don't know what's Wrong
package pl.codegym.task.task09.task0923;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
Samogłoski i spółgłoski
*/
public class Solution {
public static char[] samogloski = new char[]{'a', 'e', 'i', 'o', 'u'};
public static ArrayList<Character> samo = new ArrayList<>();
public static ArrayList<Character> spol = new ArrayList<>();
public static ArrayList<Character> other = new ArrayList<>();
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String wyraz = reader.readLine().toLowerCase();
for (int i = 0; i<wyraz.length(); i++){
isSamogloska(wyraz.charAt(i));
}
other.removeAll(other);
for (char s : samo){
System.out.print(s + " ");
}
System.out.println();
for (char s : spol){
System.out.print(s + " ");
}
}
// Ta metoda sprawdza, czy litera jest samogłoską
public static boolean isSamogloska(char c) {
c = Character.toLowerCase(c); // Konwertuje na małe litery
for (char d : samogloski) // Szuka samogłosek w tablicy
{
if (c == d){
return samo.add(c);
}
if (Character.isWhitespace(c)|| Character.isDigit(c)){
return other.add(c);
}
}
return spol.add(c);
}
}