public void fillBoard(int x, int y,char[][] board,int m ,int n){
        Stack<Integer> iStack = new Stack<Integer>();
        Stack<Integer> jStack = new Stack<Integer>();
        iStack.add(x);
        jStack.add(y);
        while(!iStack.empty()){
            x = iStack.pop();
            y = jStack.pop();
            board[x][y] = '1';

            //left
            int i = x;
            int j = y-1 > 0? y-1 : 0;
            if(board[i][j] == 'O'){
                iStack.add(i);
                jStack.add(j);
            }
            //UP
            i = x-1>0 ? x-1: 0;
            j = y;
            if(board[i][j] == 'O'){
                iStack.add(i);
                jStack.add(j);
            }
            //down
            i = x+1 < m ?x+1 : m-1;
            j = y;
            if(board[i][j] == 'O'){
                board[i][j] = '1';
                fillBoard(i,j,board,m,n);
            }
            //right
            i = x;
            j = y+1 < n? y+1: n-1;
            if(board[i][j] == 'O'){
                iStack.add(i);
                jStack.add(j);
            }
        }
    }