#include using namespace std; int main(){ int minLength = 101, length = 0; int status = 0; // 'nothing' - 0 c' - 1 : 'w' - 2 : 'w' - 3 char c; bool incww = false; for(; cin >> c;){ if(incww) length++; if(incww && c == 'c') length = 1; if(!incww && c == 'c'){ incww = true; status = 1; length = 1; } if(incww && c == 'w'){ status++; if(status == 3){ minLength = min(minLength, length); status = 0; length = 0; incww = false; } } } if(minLength == 101) minLength = -1; cout << minLength << endl; return 0; }