private void traverseRegion(boolean[][] visited, char[][] board, int x,
			int y) {
		if (board[x][y] != 'O')
			return;

		Stack<int[]> stack = new Stack<int[]>();
		stack.push(new int[] { x, y });

		int[] tmp = null;
		while (!stack.isEmpty()) {
			tmp = stack.pop();
			x = tmp[0];
			y = tmp[1];

			if (visited[x][y] || board[x][y] != 'O')
				continue;

			visited[x][y] = true;

			if (x < board.length - 1) {
				stack.push(new int[] { x + 1, y });
			}

			if (x > 0) {
				stack.push(new int[] { x - 1, y });
			}

			if (y < board[0].length - 1) {
				stack.push(new int[] { x, y + 1 });
			}

			if (y > 0) {
				stack.push(new int[] { x, y - 1 });
			}
		}

	}