using System; using System.Collections.Generic; using System.Linq; namespace chiwawa { class Program { static void Main(string[] args) { var input = Console.ReadLine(); var len = input.Length; var chiwawaList = new List(); for (int i = 0; i < len; i++) { if(input[i] == 'c') { chiwawaList.Add(new Chiwawa(i)); } else if(input[i] == 'w') { chiwawaList.ForEach(x => x.FindW(i)); } } var min = (chiwawaList.Any()) ? chiwawaList.Min(x => x.Length()) : 101; Console.WriteLine(min == 101 ? -1 : min); } } public class Chiwawa { private int _first; private int _end; private bool _nextIsEnd; private bool _isEnd; public Chiwawa(int CIndex) { _first = CIndex; } public void FindW(int WIndex) { if (_nextIsEnd && _isEnd == false) { _end = WIndex; _isEnd = true; } else { _nextIsEnd = true; } } public int Length() { if(_isEnd) { return _end - _first + 1; } return 101; } } }