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$.
If $S_i=$B
, the $i$-th piece from the left is showing black;
If $S_i=$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.
B
or W
Input is given from Standard Input in the following format:
$S$
Print the maximum possible number of times the operation can be performed.
BBW
2
The operation can be performed twice, as follows:
BWBWBW
6