#include <iostream>
#include <string>
#define rgi register int
using namespace std;
string a;
int k,book=-2147483;
int main()
{
	ios::sync_with_stdio(false);
	cin>>a;
	int len=a.length();
	for(rgi i=0;i<len;++i)
	{
		if(a[i]==a[i+1]&&book<i-2)
		{
			book=i,++i;
			//cout<<i<<" ";
		}
		++k;
	}
	cout<<k<<endl;
	return 0;
}