#include <iostream>
using namespace std;

int main() 
{
    string a;
    cin>>a;
    int i=0;
    int len=a.size();
    int ans=1;
    for(i=0;i<len;i++)
    {
        if(i+1<len  &&  a[i]!=a[i+1])
        {
            int count=1;
            while(i+1<len  &&  a[i]!=a[i+1])
            {
                count++;
                i++;
            }
            ans=max(ans,count);
            i--;
        }
    }
    cout<<ans;
    return 0;
}