output_description: Print the maximum possible number of times the operation can be performed.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      S
attempt: import sys, re, os
  from collections import deque, defaultdict, Counter
  from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
  from itertools import permutations, combinations, product, accumulate
  from operator import itemgetter, mul
  from copy import deepcopy
  from string import ascii_lowercase, ascii_uppercase, digits
  from heapq import heapify, heappop, heappush
  
  
  def input():
      return sys.stdin.readline().strip()
  
  
  def INT():
      return int(input())
  
  
  def MAP():
      return map(int, input().split())
  
  
  def S_MAP():
      return map(str, input().split())
  
  
  def LIST():
      return list(map(int, input().split()))
  
  
  def S_LIST():
      return list(map(str, input().split()))
  
  
  sys.setrecursionlimit(10**9)
  INF = float("inf")
  mod = 10**9 + 7
  
  S = input()
  N = len(S)
  tmp = 0
  ans = 0
  A = 0
  B = 0
  b_num = 0
  for i in range(1, N + 1):
      if S[i - 1] == "B":
          b_num += 1
          A += i
  
  all_wa = N * (N + 1) // 2
  B = all_wa - (N - b_num) * (N - b_num + 1) // 2
  
  print(B - A)
  
problem_description: Statement
  
  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:
  
    * 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.
  
  Find the maximum possible number of times this operation can be performed.
samples: [{"input": "BBW", "output": "2\n    \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.\n\n* * *"}, {"input": "BWBWBW", "output": "6"}]