C. Plasticine zebra

f:id:peroon:20201223173020p:plain

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input
    string s;cin>>s;
    ll N = s.size();

    string t = s+s;

    ll ma=1;
    ll len=1;
    char now=t[0];
    FOR(i,1,2*N){
      char c = t[i];
      if(now!=c){
        len++;
      }else{
        len=1;
      }
      now=c;
      chmax(ma,len);
    }
    ll ans = min(N,ma);
    p(ans);
    
    return 0;
}