using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace yukikoda { class Program { static void Main(string[] args) { string s = Console.ReadLine(); if (s.Length < 3) { Console.WriteLine("-1"); return; } int i = 0; int min = int.MaxValue; while (s.IndexOf('c', i) != -1) { i = s.IndexOf('c', i) + 1; if (i == s.Length - 1) break; int wc = 0; for (int j = i + 1; j < s.Length - 1; j++) { if (s[j] == 'w') { wc++; if (wc == 2) { if (min > j + 2 - i) { min = j + 2 - i; break; } } } } } if (min == int.MaxValue) { min = -1; } Console.WriteLine(min); } } }