#define _USE_MATH_DEFINES #include using namespace std; #define int long long string S; signed main() { cin >> S; int f = 0, ans = 1, p = 0; while (f < S.size() && S[f++] != 'c') ; for (int i = f; i < S.size(); i++) { ans++; if (S[i] == 'w') { if (++p >= 2) break; } } if (p < 2) puts("-1"); else printf("%lld\n", ans); return 0; }