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

bool b[213];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    b['a']=b['e']=b['i']=b['o']=b['u']=b['y']=true;
    long long wyn=0,kon=0;
    int licz1=0,licz2=0;
    cin>>s;
    if (s.size()==1)
    {
        cout<<"0";
        return 0;
    }
    if (b[int(s[1])])
    {
        licz1++;
        if (b[int(s[0])])
            licz1++;
    }
    else
    {
        licz2++;
        if (!b[int(s[0])])
            licz2++;
    }
    for (long long i=2; i<s.size(); i++)
    {
        if (b[int(s[i])])
        {
            licz1++;
            licz2=0;
        }
        else
        {
            licz2++;
            licz1=0;
        }
        if (licz1>2||licz2>2)
        {
            kon=i-1;
            continue;
        }
        if (i-kon>1)
            wyn+=i-kon-1;
    }
    long long k=s.size();
    wyn+=2*k-1;
    cout<<(k*(k+1))/2-wyn;
    return 0;
}