Official algorithmic problem description and constraints.
Chef and Roku are locked in an epic Rock, Paper, Scissors battle consisting of π games.
However, Chef has a secret weapon: he found a note revealing Roku's entire sequence of moves beforehand!
You are given a string π΄, where π΄πβ represents Roku's planned move in the ππ‘β game.
Each character of A is one of 'R', 'P', and 'S', denoting Rock, Paper, and Scissors, respectively.
Determine the maximum number of games Chef can win, if he is not allowed to make the same move twice consecutively.
Detailed video explanations, mathematical intuition, and clean C++ implementation code.