#include using namespace std; int main(){ string s; cin >> s; int res = -1; //一番右のcを探す int last_c = s.size(); int loop = 0; int size = s.size(); while(1){ int count_w = 0; for(int i = 0; i < size; i++){ if(s[i] == 'c'){ last_c = i; } } size = last_c; //一番右のcからwが二つ目まで探す for(int i = last_c; i < s.size(); i++){ if(s[i] == 'w'){ count_w++; } if(count_w == 2){ res = i-last_c+1; break; } } if(res != -1) break; loop++; if(loop > 100) break; } cout << res << endl; }