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