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