1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <cstdio>
#include <vector>
#include <cstring>

using namespace std;
using ll = long long;

const int MAX_N = 200003;
bool isVowel[255];
char text[MAX_N];
ll k[MAX_N];

int main() {
	scanf("%s", text);
	int n = strlen(text);
	
	for(const auto& c : {'a', 'e', 'i', 'u', 'o', 'y'}) {
		isVowel[c] = true;
	}
	
	for(int i = 3; i <= n; ++i) {
		k[i] = k[i-1] + (ll)(i-2);
	}
	
	auto prevChar = 2;
	int chain = 0;
	vector<int> b, e;
	b.push_back(0);
	
	for(int i = 0; i < n; ++i) {
		auto currentChar = isVowel[text[i]] ? 1 : 0;
		
		if(currentChar == prevChar) {
			if(++chain == 3) {
				e.push_back(i-1);
			}
		} else {
			if(chain >= 3) {
				b.push_back(i-2);
			}
			prevChar = currentChar;
			chain = 1;
		}
	}
	
	if(b.size() > e.size()) {
		e.push_back(n-1);
	}
	
	ll result = k[n];
	
	for(int i = 0; i < b.size(); ++i) {
		result -= k[e[i]-b[i]+1];
	}
	
	printf("%lld\n", result);

	return 0;
}