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
#include <iostream>
#include <string>
#include <queue>

using namespace std;

typedef long long LL;

string S;
queue<int> Q;

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

int main()
{
    ios::sync_with_stdio(0);
    cin >> S;
    for(int i = 2; i < S.size(); i++)
    {
        bool a = samogloska(S[i - 2]);
        bool b = samogloska(S[i - 1]);
        bool c = samogloska(S[i]);
        if(a == b && b == c) 
            Q.push(i);
    }
    Q.push(S.size());

    LL wynik = 0;
    while(Q.size() > 1)
    {
        int p = Q.front();
        Q.pop();
        int nast = Q.front();
        wynik += (LL)(nast - p) * (LL)(p - 1);
    }
    cout << wynik;
}