#include <iostream>
#include <cstdio>
#include <string>
#include <vector>

using namespace std;

int main()
{
	freopen("theblackpearl.in", "r", stdin);
	freopen("theblackpearl.out", "w", stdout);
	string s;
	cin >> s;
	long long ans = 0;
	int si = s.length();
	for (int i = 0; i < si; i++)
	{
		int j = i, cnt = 0;
		while (j < si && cnt < 2)
		{
			if (s[j] != '?') ++cnt;
		    if (cnt < 2) ++ans;
			++j;
		} 	
		cerr << ans << endl;
	}
	cout << ans;
}