public void solve(char[][] board) {
		// Note: The Solution object is instantiated only once and is reused by
		// each test case.
		if (board.length > 0 && board[0].length > 0) {
			int n = board.length;
			int m = board[0].length;
			boolean[][] visited = new boolean[n][m];
			for (int i = 0; i < n; i++) {
				go2(i, 0, board, visited);
				go2(i, m - 1, board, visited);
			}
			for (int j = 0; j < m; j++) {
				go2(0, j, board, visited);
				go2(n - 1, j, board, visited);
			}

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