Andrej and Barbara play the following game with two strips of newspaper of length $a$ and $b$. They alternately cut from any end of any of the strips a piece of length $d$. The player who cannot cut such a piece loses the game. Andrej allows Barbara to start the game. Find out how the lengths of the strips determine the winner.
1. **Initial Setup**: 
   - Let the lengths of the two strips be \(a\) and \(b\).
   - The length of each piece that can be cut is \(d\).

2. **Determine the number of pieces**:
   - Let \(x = \left\lfloor \frac{a}{d} \right\rfloor\) be the number of pieces of length \(d\) that can be cut from strip \(a\).
   - Let \(y = \left\lfloor \frac{b}{d} \right\rfloor\) be the number of pieces of length \(d\) that can be cut from strip \(b\).

3. **Game Strategy**:
   - The game is played alternately, and the player who cannot make a move loses.
   - If \(a = b\), Andrej can always copy Barbara's moves. This ensures that Andrej will always have a move as long as Barbara has a move, and thus Barbara will be the first to run out of moves and lose. Therefore, Andrej wins if \(a = b\).

4. **General Case**:
   - If \(a \neq b\), Barbara can make the lengths of the strips equal by cutting the larger strip to match the length of the smaller strip.
   - Once the lengths are equal, Barbara can then copy Andrej's moves, ensuring that Andrej will be the first to run out of moves and lose.

5. **Winning Condition**:
   - The total number of pieces that can be cut from both strips is \(x + y\).
   - If \(x + y\) is odd, Barbara wins because she starts the game and will make the last move.
   - If \(x + y\) is even, Andrej wins because Barbara will run out of moves first.

The final answer is Barbara wins if \( \boxed{ x + y } \) is odd, and Andrej wins if \(x + y\) is even.