#include<bits/stdc++.h>
#define ll long long
using namespace std;
string s;
ll l;
ll max(ll a, ll b)
{
    return a >= b ? a : b ;
}
ll go(ll i)
{
    if(i==l)
        return 1;
    if(s[i]!=s[i+1])
        return 1+go(i+1);
    return max(go(i+1),go(i+2));
}
int main()
{
cin>>s;
l=s.length();
ll count=go(0);
cout<<count;
return 0;
}
