{"raw_statement":[{"iden":"problem statement","content":"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.\nConsider performing the following operation:\n\n*   Choose $i$ ($1 \\leq i < N$) such that the $i$\\-th piece from the left is showing black and the $(i+1)$\\-th piece from the left is showing white, then flip both of those pieces. That is, the $i$\\-th piece from the left is now showing white and the $(i+1)$\\-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed."},{"iden":"constraints","content":"*   $1 \\leq |S| \\leq 2\\times 10^5$\n*   $S_i=$`B` or `W`"},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$S$"},{"iden":"sample input 1","content":"BBW"},{"iden":"sample output 1","content":"2\n\nThe operation can be performed twice, as follows:\n\n*   Flip the second and third pieces from the left.\n*   Flip the first and second pieces from the left."},{"iden":"sample input 2","content":"BWBWBW"},{"iden":"sample output 2","content":"6"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}