using System; using System.Linq; class Program { static void Main(string[] args) { // No.345 最小チワワ問題 string S = Console.ReadLine(); int cIdx = -1, wIdx = -1; cIdx = S.IndexOf('c'); wIdx = S.IndexOf('w', cIdx + 1); wIdx = S.IndexOf('w', wIdx + 1); if (cIdx == -1 || wIdx == -1) Console.WriteLine(-1); else Console.WriteLine(wIdx - cIdx + 1); } }