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

using namespace std;

typedef long long ll;

vector<bool> spo(26, true);

int main()
{
    ios_base::sync_with_stdio(0);
    string a;
    cin >> a;
    int n = a.size();
    if (n < 3)
    {
        cout << "0";
        return 0;
    }
    spo['a' - 'a'] = spo['e' - 'a'] =
    spo['i' - 'a'] = spo['o' - 'a'] =
    spo['u' - 'a'] = spo['y' - 'a'] = false;
    vector<ll> nast(n);
    nast[n - 1] = nast[n - 2] = -1;
    for (int i = n - 3; i >= 0; --i)
    {
        if (spo[a[i] - 'a'] == spo[a[i + 1] - 'a'] && spo[a[i] - 'a'] == spo[a[i + 2] - 'a'])
            nast[i] = i;
        else
            nast[i] = nast[i + 1];
    }
    ll odp = 0;
    for (int i = 0; i < n; ++i)
        if (nast[i] != -1)
            odp += n - nast[i] - 2;
    cout << odp;
    return 0;
}