1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <cstdio>
#define s std::scanf
#define p std::printf

char c[200004];
long long int r;

int l[2];  //  a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z	
int w[26] = {1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0};

int main() {
	s("%s",c);
	int last = 1;
	for (int i = 0; c[i]; i++) {
		int a = w[c[i] - 'a'];
		l[1 - a] = 0;
		if (++l[a] > 2) last = i;
		r += (last - 1);
	}
	p("%lld\n",r);
	return 0;
}