#include #include using namespace std; int main(void){ string s; cin >> s; int min = -1; list c; bool wE = false; for(int i = 0; i < s.length(); i++){ if(s[i] == 'c'){ c.push_back(i); }else if(s[i] == 'w'){ if(wE){ int ci = *c.begin(); c.pop_front(); if(i - ci < min || min == -1){ min = i - ci + 1; } }else if(c.size() > 0) wE = true; } } cout << min << endl; return 0; }