#include int main() { std::string s; int c = -1, w = -1, flag = 0; std::cin >> s; for (int i = 0; i < s.length(); i++) { if (s[i] == 'c') { c = i; break; } } for (int i = s.length() - 1; i >= 0 && i > c && c != -1; i--) if (s[i] == 'w') { if (w == -1) w = i; else { flag = 1; break; } } std::cout << (flag ? w - c + 1 : -1) << std::endl; return 0; }