#include <cstdio>

using namespace std;

int i, j, si;
char type;
char* s = new char[(int)2e6 + 5];
long long ans;


int main()
{
	freopen("theblackpearl.in", "r", stdin);
	freopen("theblackpearl.out", "w", stdout);
	gets(s);
	ans = 0;
	for (i = 0; s[i]; ++i)
	{
		j = i, type = '?';
		while (s[j])
		{
			if (s[j] != '?')
			{
				if (type == '?' || type == s[j]) type = s[j];
				else break;
			}
		    ++ans, ++j;
		} 	
	}
	printf("%I64d\n", ans);
}