In each round of the two-player game of Rochambo, you and your opponent simultaneously display one of three gestures: Rock, Paper, or Scissors. If both of you have made the same move, the outcome is a tie. Otherwise, Rock beats Scissors, Scissors beats Paper, and Paper beats Rock.
An optimal strategy against an opponent who makes random moves is to play randomly yourself. However, most people are incapable of generating a truly random series of moves, and it may be possible to exploit patterns in their play. According to one theory, the human mind works in the following manner. After making two consecutive moves of the same kind, the next move is likely to be the same as the previous two. But after making two different consecutive moves, the next move is likely to be different from the previous two.
Given a String containing a record of your opponent's moves, calculate how many rounds you would win if you believed in this theory. Each gesture is represented by its initial letter. Your first two moves are always Rock. Thereafter, taking into account your opponent's previous two moves, you must apply the psychological theory described above to predict your opponent's next move, and counter it with the move that would defeat it.