public void solve(char[][] board) {
        height = board.length;
        if (height == 0) return;
        width = board[0].length;
        boolean[][] checked = new boolean[height][width];
    
        for (int i = 0; i < board.length; i++) {
            for (int j = 0; j < board.length; j++) {
                if (board[i][j] == 'O' && checked[i][j] == false) {
                    boolean[][] used = new boolean[height][width];
                    if (isSurronded(i, j, used, board, checked)) {
                        for (int m = 0; m < used.length; m++) {
                            for (int n = 0; n < used.length; n++) {
                                if (used[m][n]) {
                                    board[m][n] = 'X';
                                }
                            }
                        }
                    }
                }
            }
        }
    }