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
#include <iostream>
using namespace std;

using ll = long long;

bool isvow(char a) {
    return a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u' || a == 'y';
}

bool same(char a, char b, char c) {
    bool A = isvow(a), B = isvow(b), C = isvow(c);
    return A == B && B == C;
}

int main() {
    ios_base::sync_with_stdio(0);

    string s;
    cin >> s;
    int start = 0;
    ll result = 0;
    ll n = s.size();

    for (int i=0; i < n+1; i++) {
        if (i == s.size() || (i >= 2 && same(s[i], s[i-1], s[i-2]))) {
            ll delta = (i - 1) - start;
            // cout << "fragment " << (i-1) << " " << start << endl;
            result += (delta * (delta+1))/2;
            start = i - 1;
        }
    }
    cout << (n*(n-1))/2 - result << endl;
}