#include <cstdio>
#include <fstream>
#include <string>

using namespace std;

int i, j, si;
char type;
string s;
long long ans;


int main()
{
	ifstream cin("theblackpearl.in");
	ofstream cout("theblackpearl.out");
	getline(cin, s);
	ans = 0;
	int si = s.length();
	for (i = 0; i < si; ++i)
	{
		j = i, type = '?';
		while (j < si)
		{
			if (s[j] != '?')
			{
				if (type == '?' || type == s[j]) type = s[j];
				else break;
			}
		    ++ans, ++j;
		} 	
	}
	cout << ans << "\n";
}
