using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace yukicoder_559 { class Program { static void Main(string[] args) { //A:65,B:66 char[] a = Console.ReadLine().ToCharArray(); int countB = 0; int answer = 0; for(int i = 0; i < a.Length; i++) { if (a[i] == 66) countB++; else answer += countB; } Console.WriteLine(answer); Console.ReadLine(); } } }