#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define REP(i,n) for(int i=0;i( \ ( std::ostringstream() << std::dec << x ) ).str() #define ALL(s) (s).begin(), (s).end() using namespace std; typedef long long unsigned int llu; typedef long long ll; int main (){ string S; while (cin >> S){ int w = 0; bool hasStarted = false; int cnt = 0; REP(i,S.size()){ if(!hasStarted && S[i] == 'c'){ hasStarted = true; cnt++; } if(hasStarted){ cnt++; if(S[i] == 'w') w++; if(w == 2) break; } } if(w == 2){ cout << cnt - 1<< endl; }else { cout << -1 << endl; } } return 0; }