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