using System; namespace yukicoder { class Program { static void Main(string[] args) { string s = Console.ReadLine(); int count = 0; int ans = 0; int c = 0; int w = 0; int wcount=0; if (s.IndexOf("cww") != -1) { ans = 3; } else { for (int i = 0; i < s.Length; i++) { string a = s.Substring(i, 1); count++; if (a == "c" && w == 0) { c = count; } if (c >= 1 && a == "w") { w = count; wcount++; if (wcount == 2) { if (ans == 0) { ans = w - c + 1; } else if (ans > w - c) { ans = w - c ; } c = 0; w = 0; wcount = 0; } } } if (ans == 0) { ans = -1; } } Console.WriteLine(ans); } } }