#include #include using namespace std; #define rep(i,n) for(int i = 0; i < (int)(n); ++i) string s; int main(){ while(cin >> s){ int ans = 1e9; rep(i,s.size())rep(j,i)rep(k,j){ if(s[k] == 'c' && s[j] == 'w' && s[i] == 'w'){ ans = min(ans, i-k+1); } } if(ans == 1e9) ans = -1; cout << ans << endl; } }