public void solve(char[][] board) {
	    if(board==null || board.length<=1 || board[0].length<=1)
	        return;
	    //use flood fill method at edge rows and columns
	    //first and last rows
	    for(int i=0;i<board[0].length;i++)
	    {
	        fill(board,0,i); //flood fill starting from pos(0, i)
	        fill(board,board.length-1,i);
	    }
	    //first and last column
	    for(int i=0;i<board.length;i++)
	    {
	        fill(board,i,0);
	        fill(board,i,board[0].length-1);
	    }
	    //replace
	    for(int i=0;i<board.length;i++)
	    {
	        for(int j=0;j<board[0].length;j++)
	        {
	            if(board[i][j]=='O')
	                board[i][j]='X';
	            else if(board[i][j]=='#')
	                board[i][j]='O';                
	        }
	    }
	}