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

using namespace std;

class Program
{
    string text;
    string consonants, vowels;
    long long solutions;


    // functions
    bool IsConsonantOrVovel(char c)
    {
        for (int i = 0; i < vowels.length(); i++)
        {
            if (c == vowels[i]) return true;
        }
        return false;
    }

public:
    // constructor
    Program()
    {
        // load text
        text = "";
        char c = ' ';
        while (true)
        {
            cin.get(c);
            if (c != '\n') text += c;
            else break;
        }

        consonants = "bcdfghjklmnpqrstvwxz";
        vowels = "aeiouy";

        solutions = 0;
    }

    void FindAnswer()
    {
        if (text.length() < 3)
        {
            solutions = 0;
            return;
        }

        // search for 3 consonants or 3 vowels
        bool c1, c2, c3;
        int last_diff_part = 0;

        c1 = IsConsonantOrVovel(text[0]);
        c2 = IsConsonantOrVovel(text[1]);

        for (int i = 0; i < text.length() - 2; i++)
        {
            c3 = IsConsonantOrVovel(text[i + 2]);

            if ((c1 && c2 && c3) || (!c1 && !c2 && !c3))
            {
                solutions += (i - last_diff_part + 1) * (text.length() - (i + 2));
                last_diff_part = i + 1;
            }

            c1 = c2;
            c2 = c3;
        }
    }
    long long GetAnswer()
    {
        return solutions;
    }
};

int main()
{
    std::ios_base::sync_with_stdio(0);
    std::cin.tie(0);

    Program P;
    P.FindAnswer();
    cout << P.GetAnswer() << endl;
    return 0;
}