using System; namespace No345 { class Program { static void Main(string[] args) { int pointer = 0; int[] counter = new int[3]; string word = "cww"; string text = Console.ReadLine(); foreach(char s in text) { if (word[pointer] == s) { pointer++; if (pointer == word.Length) break; } counter[pointer]++; } int sum = 1; if (pointer == word.Length) { for (int i = 1; i < word.Length; i++) sum += counter[i]; } else sum = -1; Console.WriteLine(sum); } } }