using System; namespace _559 { class Program { static void Main(string[] args) { string s = Console.ReadLine(); int ret = 0; int now = 0; for (int i = 0; i < s.Length; i++) { if (s[i] == 'B') now++; else ret += now; } Console.WriteLine(ret); } } }