#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
char ch[N];
int main()
{
	scanf("%s",ch);
	int i=0,k=0,ans=0;
	while(i<strlen(ch))
	{
		if(k==0)ans++,k=1,i++;else
			{
				if(!((ch[i]==ch[i-1])&&(i==strlen(ch)-1)))ans++;
				if(ch[i]==ch[i-1])i+=2,k=0;else i++;
			}
	}
	printf("%d\n",ans);
    return 0;
}