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

using namespace std;

string s;

bool vow(long long x)
{
    if (s[x]=='a' || s[x]=='e' || s[x]=='i' || s[x]=='o' || s[x]=='u' || s[x]=='y')
        return true;
    return false;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>s;
    long long maks=0, ans=0;
    maks=(s.size())*(s.size()+1); maks/=2;
    long long l=0, ost=0, p=0;
    bool first=false;
    while (p<s.size())
    {
        while (p+1<s.size() && vow(ost)==vow(p+1))
            p++;
        if (p-ost+1>=3)
        {
            if (first==false)
            {
                ans=(ost)*(ost+1); ans/=2;
                ans+=(2*ost);
                maks-=ans;
            }
            else
            {
                ans=(ost-l-1)*(ost-l); ans/=2;
                ans+=4*(ost-l+1);
                ans-=4;
                maks-=ans;
            }
            maks-=(2*p-2*ost+1);
            first=true;
            l=p;
        }
        p++;
        ost=p;
    }
    if (first==false) cout<<0<<"\n";
    else
    {
        p--;
        ans=((p-l)*(p-l+1)); ans/=2;
        ans+=(2*(p-l));
        maks-=ans;
        cout<<maks<<"\n";
    }
}