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
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

inline bool isVowel(std::string::value_type const a)
{
  return (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u' || a == 'y');
}


bool equalType(std::string::value_type const a, std::string::value_type const b)
{
  if (isVowel(a) && isVowel(b))
    return true;
  if (!isVowel(a) && !isVowel(b))
    return true;
  return false;
}

int main()
{
  string s;
  cin >> s;
  const auto maxsize = s.length();
  vector<unsigned short> num(maxsize, 0);

  num[0] = 1;
  for (auto i = 1u; i < maxsize; i++)
  {
    if (equalType(s[i], s[i-1]))
      num[i] = num[i-1] + 1;
    else
      num[i] = 1;
  }
  //for (auto x : s)
    //cout << x << " ";
  //cout <<endl;
  //for (auto x : num)
    //cout << x << " ";
  //cout <<endl;

  unsigned long long sum = 0;
  unsigned long long prevNoProblem = 2;
  //unsigned long long prevProblem = 0;
  for (auto i = 2u; i < maxsize; i++)
  {
    if (num[i] == 3)
      prevNoProblem-=2;
    if (num[i] == 1 && num[i-1] > 2)
    {
      prevNoProblem = 2;
    }
    if (num[i] < 3)
      prevNoProblem++;

    auto const numAfterPos = maxsize - i - 1;
    if (num[i] == 3)
    {
      auto x = max((prevNoProblem == 0 ? 0 : prevNoProblem + 1), 1ULL) * (numAfterPos + 1);
      sum += x;
      //cout << "NumAfterPos = "<<numAfterPos << " prevNoProblem="<<prevNoProblem<< " prevProblem="<<prevProblem<<" sum +="<<x<<endl;
    }
    if (num[i] > 3)
    {
      auto x = numAfterPos + 1;
      sum += x;
      //cout << "numAfterPos = "<<numAfterPos << " prevNoProblem="<<prevNoProblem<< " prevProblem="<<prevProblem<<" sum +="<<x<<endl;
    }
    //cout << "i="<<i<< " prevNoProblem="<<prevNoProblem<<endl;
  }
  cout << sum << endl;


  return 0;
}