private static String[][] filter(String[][] input, String filter) {
        if (filter.equals("") || input.length==0) return input;
        else {
            ArrayList<Integer> selected = new ArrayList<Integer>();

            for (int j = 0; j<input.length; j++) {
                for (int i = 0; i < input[0].length; i++) {
                    String check=input[j][i].replaceAll(" ", "");
                    check.toLowerCase();
                    if (check.contains(filter.toLowerCase())) {
                        selected.add(j);
                    }
                }
            }


            int size=input[0].length;
            String[][] result = new String[selected.size()][size];

            int index = 0;
            for (int i = 0; i < input.length; i++) {
                if (selected.contains(i)) {
                    for (int j = 0; j < input[0].length; j++) {
                        result[index][j] = input[i][j];
                    }

                    index++;
                }
            }

            return result;
        }
    }