import sequtils,strutils var S = stdin.readline cnt : int ans : int for s in S: if s == 'B': cnt += 1 else: ans += cnt echo ans