using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace YukiCoder { class Program { static void Main(string[] args) { var va = Console.ReadLine(); int[] pn = new int[va.Length]; int sum = 0; for (int i = 0, j = 0; i < va.Length; i++) { if (va[i] == 'A') sum += i - j++; } Console.WriteLine(sum); Console.ReadLine(); } } }