#include"iostream"
#include<vector>
#include<math.h>
#include"algorithm"
#include"string"
using namespace std;
int main()
{
	string s;
	cin >> s;
	int count = 0;
	int y = 0;
	bool ya=false;
	int len = s.length();
	//vector<string>cont[100000];
	
	for (int i = 0; i < len; i++)
	{
		bool o = false;
		string g;
		if (i > 1)
		{
			if (s[i - 1]== s[i])
				o = true;

		}
		
		g = s[i + 1];
		 if ((s[i] == s[i + 1]) || o) {
			//cont[i+1]= s[i] + s[i + 1];
			//g += s[i] + s[i + 1];

			//cout << s[i] << s[i + 1] << endl;
			//cout << s[i + 2] << endl;
			count += 2;
			i += 2;
			y = i;
			ya = true;
		}
		
		 else if (ya&&o&&(s[i]!=s[i+1]))
		{
			count++;
			ya = false;
			//cout << "   1";
			//cout << s[i] << endl;



		}
		
		
		else if ((s[i] != s[i + 1]))
		 {
			 //cont[i] = s[i];
			 count++;
			// cout << s[i] << "    2" << endl;
		 }


	}
	cout << count;




