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 <bits/stdc++.h>

using namespace std;
typedef long long ll;

bool isSamogloska(char c) {
    string samogloski = "aoeiuy";
    for (int i = 0; i < samogloski.size(); i++)
        if (c == samogloski[i]) return true;
    return false;
}

int main() {
    ios_base::sync_with_stdio(0);
    string s;
    cin >> s;
    vector<ll> A(s.size()+1), B(s.size()+1);
    for(ll i = 0; i < A.size(); i++) A[i] = B[i] = 0;

    for (ll i = 0; i < s.size(); i++) {
        if (isSamogloska(s[i])) {
            A[i+1] = A[i] + 1;
        } else {
            B[i+1] = B[i] + 1;
        }
    }

    ll sum = 0;
    ll result = 0;
    ll last = 0;

    for (ll i = 0; i < B.size(); i++) {
        if(B[i] >= 3 || A[i] >= 3) {
            result += (i - 2 - last) * (A.size() - i);
            last = i-2;
        }
    }

    cout << result << endl;
}