#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(a,b) for(long long a = 0;a < b;++a) int main() { string hoge; cin >> hoge; int ans = 300; for (int i = 0;i < hoge.length()-2;++i) { if (hoge[i] == 'c') { for (int q = i+1;q < hoge.length()-1;++q) { if (hoge[q] == 'w') { for (int j = q + 1;j < hoge.length();++j) { if (hoge[j] == 'w') { ans = min(ans, j - i+1); } } } } } } if (ans == 300) { cout << "-1" << endl; } else { cout << ans << endl; } } //thank you for reading my code!