First note that we can think of the row as a row of $0$'s and $1$'s because we only care about pairity.

Let $n$ be the length of the row.

Claim:

$1)$. if $n$ is even and $A$ begins, than $A$ wins.

$2)$. if $n$ is odd and $B$ begins, than $A$ wins.

Note that $1)$ is enough for us for the problem, but we will prove both $1$ and $2$ simultaneously by induction on $n$.

The base cases $n=1,2,3$ are trivial. Suppose now the claim holds for $1,2,...,n-1$ and let's prove it for $n$.

If $n$ is even, the row is of the form $1,0,1,0,1,0,....,1,0$ and we may take the last pair of $(1,0)$ and make it a $1$. By induction hypothesis, since now it is $B$'s turn, $A$ wins.

If $n$ is odd and $B$ begins, the row is of the form $1,0,1,0,1,0,....,1,0,1$.

Player $B$ might pick a pair of the form $(1,0)$ or a pair of the form $(0,1)$, and replace this pair with a $0$ or a $1$. Note that doesn't matter what pair he chose to replace, there is either a $1$ right before it or a $1$ right after it: there is a $1$ after each pair of the form $(1,0)$ and there is a $1$ before each pair of the form $(0,1)$. Therefore the two numbers $B$ chose to replace are part of $3$ consecutive numbers in the row, which are $1,0,1$ (and $B$ chose either the first two or the last two of those three). Doesn't matter what $B$ did, we can make the $1,0,1$ that $B$ chose his pair from a $1$. For example, if $B$ chose the first two and made them a $0$, the $1,0,1$ became a $0,1$, which $A$ can make a $1$ from. Therefore, after $A$'s second turn, the difference from the original row is that a $1,0,1$ was replaced by a $1$. Now, since it is $B$'s turn now, by induction hypothesis $A$ wins.

## Best Answer

Commonly, with a game like this one (two-player, symmetric, zero-sum games of perfect information and no possibility of a tie), you can start at the end of the game and work your way backwards, marking each board position as either a winning position or a losing position, defined recursively by the two rules:

For instance:

After you do this a few more times, you might notice that the losing positions become pretty rare, and we can further investigate what pattern they follow. In this case, we find that the losing positions are all the positions with $3(2^n)-1$ coins for $n \geq 0$ an integer.

Once you have that, the winning strategy is fairly apparent. Whatever position the board is in on your turn, you must take away the right number of coins to leave $3(2^n)-1$ coins on your opponent's turn. Proving that this is a winning strategy amounts to an inductive proof that having $3(2^n)-1$ coins at the start of your turn is a losing position as defined by the two rules I gave above, which effectively is just noting $$\frac{1}{2}\Big(3(2^n)-1-1\Big) \leq 3(2^{n-1})-1 < \frac{1}{2}\Big(3(2^n)-1\Big).$$

In a game starting with $200$ coins, if we go first, we should take $9$ coins, leaving $3(2^6)-1 = 191$ coins. Following this strategy each turn will result in our win.