using System; using System.Collections.Generic; using System.Linq; namespace Test { class Program { static void Main(string[] args) { string s = Console.ReadLine(); int ret = int.MaxValue; for (int i = 0; i < s.Length; i++) { if (s[i] == 'c') { int j; int w = 0; for (j = 1; i + j < s.Length && w != 2; j++) { if (s[i + j] == 'w') w++; } if (w == 2) { ret = Math.Min(ret,j); } } } Console.WriteLine(ret == int.MaxValue ? -1 : ret); } } }