#include using namespace std; int main() { string s; cin >> s; int ans = 101; int S = s.size(), w1 = S, w2 = S; for(int i = S - 1; i >= 0; i--){ if(s[i] == 'w'){ w1 = w2; w2 = i; } if(s[i] == 'c' && w1 != S){ ans = min(ans, w1 - i + 1); } } if(ans == 101)cout << -1 << endl; else cout << ans << endl; return 0; }