using System; using System.Collections.Generic; using System.Linq; namespace _345 { class Program { static void Main(string[] args) { var s = Console.ReadLine(); var sizes = new List(); for (int x1 = 0, len = s.Length; x1 < len; x1++) { if (s[x1] != 'c') { continue; } var x2 = s.IndexOf('w', x1 + 1); if (x2 == -1) { continue; } var x3 = s.IndexOf('w', x2 + 1); if (x3 == -1) { continue; } sizes.Add(x3 - x1 + 1); } if (sizes.Any()) { Console.WriteLine(sizes.Min()); } else { Console.WriteLine(-1); } } } }