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>
#include <cstring>

const int N = 200007;
char tab[N];
bool sam[130];
bool trudne[N];

int main() {
    sam['a'] = sam['e'] = sam['i'] = sam['o'] = sam['u'] = sam['y'] = true;
    scanf("%s", tab);
    long long n = (long long)(strlen(tab));
    for (int i = 0; i + 2 < n; i++)
            trudne[i] = (sam[tab[i]] == sam[tab[i + 1]] && sam[tab[i]] == sam[tab[i + 2]]);
    int k = 0;
    long long latwe = 0;
    for (int i = 0; i < n; i++) {
        if (trudne[i]) {
            if (i == n - 1)
                latwe++;
            else
                latwe += 2;
        }
        else {
            k = std::max(k, i);
            while (k < n - 1 && !trudne[k + 1])
                k++;
            latwe += std::min(k + 3, int(n)) - i;
        }
    }
    printf("%lld", n * (n + 1) / 2 - latwe);
    return 0;
}