#include int main(){ char in[101]; int a, p = 0, i = 0, ans = 101; scanf("%s", in); while(in[i] != '\0'){ switch(p){ case 0: if(in[i] == 'c'){ a = 1; p = 1; } break; case 1: a++; if(in[i] == 'c') a = 0; if(in[i] == 'w') p = 2; break; case 2: a++; if(in[i] == 'w'){ if(a < ans) ans = a; p = 0; } } i++; } if(ans == 101) ans = -1; printf("%d\n", ans); return 0; }