#include #include using namespace std; int main() { int state,ans; //state 0:NO 1:c 2:w 3:w string S; cin >> S; int i = 0; ans = 0; state = 0; while(S[i]) { switch(state) { case 0: if(S[i] == 'c') state = 1; break; case 1: if(S[i] == 'w') state = 2; break; case 2: if(S[i] == 'w') state = 3; break; } if(state != 0) ans++; if(state == 3) break; i++; } if(state == 3) cout << ans << endl; else cout << "-1" << endl; return 0; }