#include<bits/stdc++.h>
using namespace std;
char s[200010];
int dp[200010];
int n;
int main(){
	cin>>(s+1);
	n=strlen(s+1);
	dp[1]=1;
	if(s[2]==s[1])dp[2]=1;
	else dp[2]=2;
	for(int i=3;i<=n;i++){
		if(s[i]==s[i-1])dp[i]=dp[i-3]+2;
		else dp[i]=dp[i-1]+1;
	}
	cout<<dp[n]<<endl;
	return 0;
}
