using System; using System.Collections.Generic; namespace No346 { class Program { static void Main(string[] args) { int count_c = 0; List count_w = new List(); long num = 0; int count = 0; string text = Console.ReadLine(); for (int i = 0; i < text.Length; i++) { if (text[i] == 'c') { count_w.Add(count_c); count_c = 0; } if (text[i] == 'w') count_c++; } count_w.Add(count_c); for (int i = count_w.Count - 1; i > 0; i--) { count += count_w[i]; if (count > 1) { num += count * (count - 1) / 2; } } Console.WriteLine(num); } } }