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

using namespace std;

struct Triplet
{
    int startIndex, endIndex;
    
    Triplet(int start)
    {
        startIndex = start;
        endIndex = startIndex + 2;
    }
};

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

bool isUnreadableTriplet(char a, char b, char c)
{
    return (isVowel(a) && isVowel(b) && isVowel(c)) ||
           (!isVowel(a) && !isVowel(b) && !isVowel(c));
}

int main()
{
    ios_base::sync_with_stdio(false);
    
    string s;
    unsigned int i;
    stack<Triplet> unreadableTriplets;
    unsigned long long int result = 0;
    
    cin >> s;
    for (i = 1; i < s.length() - 1; ++i)
    {
        if (isUnreadableTriplet(s[i - 1], s[i], s[i + 1]))
            unreadableTriplets.push(Triplet(i - 1));
    }
    
    while (!unreadableTriplets.empty())
    {
        Triplet currentTriplet = unreadableTriplets.top();
        unreadableTriplets.pop();
        
        unsigned int substringsStartingWithTriplet = s.length() - currentTriplet.endIndex;
        unsigned int substringsEndingWithTriplet;
        
        if (!unreadableTriplets.empty())
        {
            Triplet previousTriplet = unreadableTriplets.top();
            substringsEndingWithTriplet = currentTriplet.startIndex - previousTriplet.startIndex;
        }
        else
            substringsEndingWithTriplet = currentTriplet.startIndex + 1;
            
        result += (unsigned long long int) substringsStartingWithTriplet * (unsigned long long int) substringsEndingWithTriplet;
    }
    
    cout << result << "\n";

    return 0;
}