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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cstdint>

using namespace std;

bool isVowel(char c)
{
    std::vector<char> vowel {'a', 'e', 'i', 'o', 'u', 'y'};
    auto iter = find(vowel.begin(), vowel.end(), c);
    
    if (iter != vowel.end())
        return true;
    return false;
}

int main()
{
    cin.tie(0);
    std::ios_base::sync_with_stdio(false);
    string in;
    cin>>in;
    
    vector< pair<int, int> > indices;
    indices.reserve(in.size());
    
    int start = 0;
    bool prevVowel = isVowel(in[0]);
    int counter = 1;
        
    for(int i = 1; i < in.size(); ++i)
    {
        if (isVowel(in[i]) == prevVowel)
        {
            ++counter;
            continue;
        }
        else
        {
            if (counter >= 3)
            {
                indices.push_back(make_pair(start, i-1));
            }
            start = i;
            prevVowel = !prevVowel;
            counter = 1;
        }
    }
    
    if (counter >= 3)
    {
        indices.push_back(make_pair(start, in.size()));
    }
    
    uint64_t result = 0;
    if (indices.empty())
    {
        cout << "tutaj 0" <<endl;
        return 0;
    }
    int b = indices[0].first;
    int e = indices[0].second;
    result += b + (in.size() - b - 3) + (b * (in.size() - b - 3)) + 1;
    for(int i = 0; i < e - b - 2; ++i)
    {
        result += (in.size() - b - 3) - i;
    }
    
    int prevE = e;
    for(int iter = 1; iter < indices.size(); ++iter)
    {
        int b = indices[iter].first;
        int e = indices[iter].second;
        int e2 = b + 3;
        result += b - (prevE - 1) + (in.size() - e2) + ((b - (prevE - 1)) * (in.size() - e2)) + 1;
        
        for(int i = 0; i < e - b - 2; ++i)
        {
            result += (in.size() - b - 3) - i;
        }
        prevE = e;
    }
    
    cout << result << endl;
}