#include #include using namespace std; int main(){ string S; cin >> S; int i, Clen, Wlen; //cout << S << endl; //cout << S[2] << endl; //cout << S.size() << endl; for(i = 0; i < S.size()-1; i++){ if(S[i] == S[i+1]){ continue; } else{ break; } } Clen = i+1; Wlen = S.size() - Clen; if(Clen - 1 >= Wlen){ cout << Wlen << endl; } else{ cout << Clen - 1 << endl; } return 0; }