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;
using LL = long long;

set<char> vowels = {'a', 'e', 'i', 'o', 'u', 'y'};
string s;
LL res;
int next[1000006];

int main() {
	cin >> s;

	int pocz = 0;
	int last = -1;
	for (int i = 2; i < (int)s.size(); ++i) {
		int threeVowels = vowels.count(s[i]) & vowels.count(s[i - 1]) & vowels.count(s[i - 2]);
		int threeConsonants = !vowels.count(s[i]) & !vowels.count(s[i - 1]) & !vowels.count(s[i - 2]);

		if (threeVowels || threeConsonants) {
			last = i - 2;
			res += (LL)i - 1LL;
		}
		else if (last != -1) {
			// cout << "? " << last << endl;
			res += (LL)last + 1;
		}

		// cout << res << " " << last << endl;
	}


	cout << res;
}