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
#include <bits/stdc++.h>

int vowel_arr[26];
char s[200004];

int& vowel(int c) { return vowel_arr[c - 'a']; }

int main()
{
	memset(vowel_arr, 0, sizeof(vowel_arr));
	for (char c : std::string("aeiouy"))
		vowel(c) = 1;
	scanf("%s", s);
	int i = 0;
	int n =  strlen(s);
	int type[2] = {0, 0};
	int last = -1;
	long long total = 0;
	for (char *c = s; *c; c++, i++)
	{
		int t = vowel(*c);
		type[t ^ 1] = 0;
		if (++type[t] < 3)
			continue;
		int j = i - 2;
		total += (j - last) * (long long) (n - i);
		last = j;
	}
	printf("%lld\n", total);
	return 0;
}