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>
using namespace std;
//************************************************************************************************************************************************
string tekst;
//************************************************************************************************************************************************
bool typ(char litera);
//************************************************************************************************************************************************
int main()
{
    ios_base::sync_with_stdio(false);

    cin>>tekst;

    int ilosc = 0;
    int stary_poczatek = -1;
    int nowy_poczatek = 0;
    bool akt = false;
    long long wynik = 0;

    for(int i = 0;i<tekst.size();i++)
    {
        if(akt == typ(tekst[i]))
        {
            ilosc++;
        }
        else
        {
            ilosc = 1;
            nowy_poczatek = i;
            akt = typ(tekst[i]);
        }

        if(ilosc > 3)
        {
            ilosc = 3;
            nowy_poczatek++;
        }

        if(ilosc == 3)
        {
            if(i == tekst.size() - 1)
            {
                if(stary_poczatek == -1)
                {
                    wynik += (nowy_poczatek) + 1;
                }
                else
                {
                    wynik += (nowy_poczatek - stary_poczatek);
                }

            }
            else
            {
                if(i == 2)
                {
                    wynik += tekst.size() - 2;
                }
                else
                {
                    if(nowy_poczatek - stary_poczatek == 1)
                    {
                        wynik += tekst.size() - i;
                    }
                    else
                    {
                        wynik += (tekst.size() - i) * (nowy_poczatek - stary_poczatek);
                    }
                }
            }

            stary_poczatek = nowy_poczatek;
        }
    }

    cout<<wynik;
}
//************************************************************************************************************************************************
bool typ(char litera)
{
    if(litera == 'a' || litera == 'e' || litera == 'u' || litera == 'y' || litera == 'o' || litera == 'i')
    {
        return false;
    }
    return true;
}
//************************************************************************************************************************************************