#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int len=s.length();
	string s1;string s2;
	s1=s[0];int t=1;int flag=0;int sum=0;
	while(1)
	{
		s2=s[t];
		while(s1==s2)
		{
			
			t++;
			if(len<t){
				flag=1;
				break;
			}
			s2+=s[t]
		}
		if (flag==1)break;
		t++;
		s1=s2;
		sum++;
	}
	cout<<sum;
} 