using System; using System.Text; using System.Text.RegularExpressions; class Program { static void Main(string[] args) { var s = Console.ReadLine(); var match = Regex.Match(s, @"c.*?w.*?w"); if (match.Success) Console.WriteLine(match.Length); else Console.WriteLine("-1"); #if DEBUG Console.ReadLine(); #endif } }