#include<bits/stdc++.h>
using namespace std;
#define re register
char ss[1001000];
int main()
{
	scanf("%s",ss+1);
	re int n,ans=0;
	n=strlen(ss+1);
	for(re int i=1;i<=n;)
	{
		if(i!=1&&ss[i]==ss[i-1])
		{
			if(n-i+1==1)break;
			else if(n-i+1==2){ans++;break;}
			else i+=3,ans+=2;
		}else i++,ans++;
	}
	printf("%d\n",ans);
}