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

const int ac = 1e6 + 6;
bool A[ac];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	vector<int> T;
	string s; cin >> s;
	for (int i = 0; i < s.size(); i++) A[i] = (s[i] == 'a' || s[i] == 'e' ||
			s[i] == 'i' || s[i] == 'o' || s[i] == 'u' || s[i] == 'y');
	int n = s.size();
	int c = 0, c2 = 0;
	for (int i = 0; i < n; i++)
	{
		if (A[i]) c++;
		else c = 0;
		if (c >= 3) T.push_back(i);
		if (!A[i]) c2++;
		else c2 = 0;
		if (c2 >= 3) T.push_back(i);
	}
	int j = 0;
	long long w = 0;
	for (int i = 0; i < n; i++)
	{
		while (j < T.size() && T[j] < i + 2) j++;
		if (j < T.size()) w += n - T[j];
	}
	cout << w << '\n';
}