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

using namespace std;

bool samogloska[150];
int ilekonczyna[200000];

int main() {
    samogloska['a'] = true;
    samogloska['o'] = true;
    samogloska['u'] = true;
    samogloska['i'] = true;
    samogloska['e'] = true;
    samogloska['y'] = true;
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string a;
    cin >> a;
    ilekonczyna[1] = 0;
    long long int result = 0;
    int i = 2;
    int size = a.length();
    while(i < size) {
        if((samogloska[a[i]] and samogloska[a[i - 1]] and samogloska[a[i - 2]]) or (!samogloska[a[i]] and !samogloska[a[i - 1]] and !samogloska[a[i - 2]])) ilekonczyna[i] = i - 1;
        else ilekonczyna[i] = ilekonczyna[i - 1];
        result += ilekonczyna[i++];
    }
    cout << result;
    return 0;
}