class Program { static void Main(string[] args) { string str = Console.ReadLine(); int cwwCount = 0; bool cFlg = false; int wCount = 0; for(int i = 0; i < str.Length; i++) { if (str[i] != 'c' && !cFlg) { continue; } cwwCount++; if (str[i] == 'c') { cFlg = true; cwwCount = 1; wCount = 0; continue; } if (str[i] == 'w' ) { wCount++; if(wCount == 2) { break; } } } if(cwwCount == 0 || cwwCount != 0 && wCount != 2) { Console.WriteLine(-1); } else { Console.WriteLine(cwwCount); } } }