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'); // C wIdx = S.IndexOf('w', cIdx); // w(1文字目) wIdx = S.IndexOf('w', wIdx + 1); // w(2文字目) if (cIdx == -1 || wIdx == -1) Console.WriteLine(-1); else Console.WriteLine(wIdx - (cIdx - 1)); } }