Score : $300$ points
There are $N$ Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)
The state of each piece is represented by a string $S$ of length $N$.
B, the $i$-th piece from the left is showing black;
W, the $i$-th piece from the left is showing white.
Consider performing the following operation:
Find the maximum possible number of times this operation can be performed.
Input is given from Standard Input in the following format:
Print the maximum possible number of times the operation can be performed.
The operation can be performed twice, as follows: