str=input() ans=0 li=[Falsefor i inrange(len(str))]#记录i位置是否匹配过 for i inrange(len(str)): ifstr[i]!="?": if li[i]==False: if (i-1)>=0andstr[i-1]==str[i] and (li[i-1]==False): li[i-1]=True li[i]=True ans+=1 elif (i+1)<len(str) andstr[i+1]==str[i] and (li[i+1]==False): li[i]=True li[i+1]=True ans+=1 else: if (li[i]): continue if (i-1)>=0and (li[i-1]==False): li[i-1]=True li[i]=True ans+=1 elif (i+1)<len(str) and (li[i+1]==False): li[i]=True li[i+1]=True ans+=1 print(ans)