using System; namespace No346 { class Program { static void Main(string[] args) { int count_c = 0; int[] count_w = new int[100000]; int 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 += Factorial(count) / (2 * Factorial(count - 2)); } } Console.WriteLine(num); } static int Factorial(int num) { int result = 1; for (int i = 1; i <= num; i++) result *= i; return result; } } }