#include #include #include #include #include #include #include using namespace std; #define diff(x,y) ((x > y) ? (x - y) : (y - x)) #define us(x) (x > 0) ? x : x * -1 int main() { int min = 1000; string str; cin >> str; for (int i = 0; i < str.size() - 2; i++) { if (str[i] == 'c'){ int w = 0; for (int j = 1;i + j < str.size(); j++) { if (str[i + j] == 'w') w++; if (w == 2) { if (j < min) min = j; goto A; } } } A:; } if (min != 1000) cout << min + 1 << endl; else cout << -1 << endl; return 0; }