#include using namespace std; #define rep(i,a,b) for(int i=a;i> s; int phase = 0; int ans; rep(i, 0, s.length()) { if (phase == 0 && s[i] == 'c') { phase++; ans = i; } else if (phase == 1 && s[i] == 'w') phase++; else if (phase == 2 && s[i] == 'w') { phase++; ans = i - ans + 1; } } if (phase == 3) cout << ans << endl; else cout << -1 << endl; }