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 <iostream>
#include <vector>
#include <algorithm>

#define lint long long

int main() {
    std::vector<char> vowel{'a', 'e', 'i', 'o', 'u', 'y'};
    const int max_n = 200 * 1000;
    int n, A[max_n];
    std::string txt;
    std::ios_base::sync_with_stdio(false);
    std::cin >> txt;
    n = txt.size();
    A[n - 1] = -1;
    A[n - 2] = -1;
    for(int i = n - 3; i >= 0; i--) {
        int s = 0;
        for(int j = i; j < i + 3; j++)
            if(find(vowel.begin(), vowel.end(), txt[j]) != vowel.end())
                s++;

        if(s == 3 || s == 0)
            A[i] = i + 2;
        else
            A[i] = A[i + 1];
    }
    lint result = 0;
    for(int i = 0; i < n; i++)
        if(A[i] != -1)
            result += n - A[i];
    std::cout << result;
    return 0;
}