public void solve(char[][] board) {

		if (board == null || board.length == 0 || board[0].length == 0) // CHECK THIS!
			return;

		int m = board.length;
		int n = board[0].length;

		for (int i = 0; i < m; i++) { // write indices according to the dimensions
			floodFill(board, i, 0);
			floodFill(board, i, n - 1);
		}

		for (int j = 0; j < n; j++) {
			floodFill(board, 0, j);
			floodFill(board, m - 1, j);
		}

		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				if (board[i][j] == 'G')
					board[i][j] = 'O';
				else if (board[i][j] == 'O')
					board[i][j] = 'X';
			}
		}
	}