#include #include #include #include #include #include #include #include #include #include #include using namespace std; #define ll long long #define INF (1 << 30) #define INFLL (1LL << 60) string str; int bfs(int now,int how){ int a,b; } int main() { cin >> str; int ans = INF; for(int i = 0;i < str.size();i++){ if(str[i] == 'c'){ int how = 0; for(int j = 0;j < str.size();j++){ if(str[j] == 'w') how++; if(how == 2) { ans = min(ans,j-i+1); break; } } } } //cout << INF << endl; if(ans == INF) cout << "-1" << endl; else cout << ans << endl; return 0; }