using System; namespace yukicoder { class Program { static void Main(string[] args) { var str = Console.ReadLine(); string[] strings = new string[str.Length]; int C = 0 , W = 0 , Ccnt = 0 , Wcnt = 0 , anscount = 0; for (int i = 0; i < str.Length; i++) { if(str.Substring(i,1) == "c" && Wcnt == 0) { C = 1; Ccnt = i; } else if (str.Substring(i, 1) == "w" && C == 1) { W++; Wcnt = i; } if(C == 1 && W == 2) { int sum = Wcnt - Ccnt + 1; anscount = sum; C = 0; Ccnt = 0; W = 0; Wcnt = 0; } } if(anscount > 0) { Console.WriteLine(anscount); } else if (anscount == 0) { Console.WriteLine("-1"); } } } }