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
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>

char tab[200001];

inline bool is_vowel(char c) {
    c = tolower(c);
    return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'y';
}

int main() {

	scanf("%s", tab);
	int LEN = strlen(tab);

	std::vector<int> d_ends;
	for (int i = LEN-1; i >= 2; --i)
	{
		if (is_vowel(tab[i-2]) && is_vowel(tab[i-1]) && is_vowel(tab[i])) 
			d_ends.push_back(i);

		if (!is_vowel(tab[i-2]) && !is_vowel(tab[i-1]) && !is_vowel(tab[i])) 
			d_ends.push_back(i);
	}

	/*
	printf("ends:");
	for (int e : d_ends)
		printf(" %d", e);
	printf("\n");
	*/

	long long result = 0LL;
	for (int i = 0; i < LEN; ++i)
	{
		while (!d_ends.empty() && d_ends.back() < i + 2)
			d_ends.pop_back();

		if (d_ends.empty())
			break;

		// for (int j = d_ends.back(); j < LEN; ++j)
		//	printf("%.*s\n", j-i+1, &tab[i]);

		result += (LEN - d_ends.back());
	}

	printf("%lld\n", result);

	return 0;
}