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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <bits/stdc++.h>

#define DEBUG if (0)
#define COUT cout << "\e[36m"
#define VAR(v) " [\e[32m" << #v << "\e[36m=\e[91m" << v << "\e[36m] "
#define ENDL "\e[39m" << endl

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    string instr;
    cin >> instr;
    long long n = instr.size();
    for(int i = 0; i < n; i++)
    {
        if(instr[i] == 'a' || instr[i] == 'e' || instr[i] == 'i' || instr[i] == 'o' || instr[i] == 'u' || instr[i] == 'y')
            instr[i] = 0;
        else instr[i] = 1;
    }
    if(n < 3)
    {
        cout << 0 << endl;
        return 0;
    }
    //vector<char> vec(n, 0);
    vector<long long> pos;
    pos.push_back(0);
    for(int i = 2; i < n; i++)
    {
        if(instr[i-2]+instr[i-1]+instr[i] == 3 || instr[i-2]+instr[i-1]+instr[i] == 0)
            pos.push_back(i-1);
            //vec[i-1] = 1;
    }
    pos.push_back(n-1);
    long long ans = (n*(n+1))/2;
    ans-= n+n-1;
    DEBUG for(auto el : instr)
        COUT << (int)el  << " ";
    DEBUG COUT << ENDL;
    DEBUG COUT << VAR(ans) << ENDL;
    DEBUG for(auto el : pos)
        COUT << el  << " ";
    DEBUG COUT << ENDL;
    for(int i = 1; i < (int)pos.size(); i++)
    {
        long long dist = pos[i]-pos[i-1]+1;
        DEBUG COUT << VAR(dist) << VAR((dist*(dist+1ll))/2ll-(2ll*dist-1ll)) << VAR(ans) << ENDL;
        ans -= (dist*(dist+1ll))/2ll-(2ll*dist-1ll);

    }
    cout << ans << endl;

    return 0;
}