using System; public class Program { public static void Main() { var S = Console.ReadLine(); int min = int.MaxValue; for (int i = 0; i < S.Length - 2; i++) { if (S[i] == 'c') { int w = 0; for (int j = i + 1; j < S.Length; j++) { if (S[j] == 'w') { if (++w == 2) { min = Math.Min(min, j - i + 1); break; } } } } } Console.WriteLine(min < int.MaxValue ? min : -1); } }