using System; public class Program { public void Solve() { char[] c = Console.ReadLine().ToCharArray(); int min = c.Length + 1; for (int i = 0; i < c.Length; i++) { int count = 0; int w = 0; if (c[i].Equals('c')) { count++; for (int j = i + 1; j < c.Length; j++) { count++; if (c[j].Equals('c') && w == 0) { i = j - 1; break; } else if (c[j].Equals('w')) { w++; if (w == 2 && count < min) { min = count; break; } } } } } if (min == c.Length + 1) { Console.WriteLine(-1); } else { Console.WriteLine(min); } } public static void Main(string[] args) { Program program = new Program(); program.Solve(); } }