s=input()
count=0
i=0
try:
	while i<len(s):
		if i+1 == len(s):
			break
		else:
			x1=x2=x3=""	
			if s[i]!=s[i+1]:
				x1=s[i]
				x2=s[i+1]
				if (i+2)!=len(s):
					x3=s[3]
				if x3!=x2 and x3!=x1 and x3!="":
					count=count+1
					s = s[:i+1] + s[(i+3):]
					i=0
					continue
				else:
					count=count+1
					s = s[:i] + s[(i+2):]
					i=0
					continue
			#print(s)
			#print(i)

		i=i+1
except:
	pass					
print(count)					
				