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

using namespace std;

unordered_set<char> vowels = {'a', 'e', 'i', 'o', 'u', 'y'};

inline bool isVowel(const char c)
{
  return vowels.find(c) != vowels.end() ? true : false;
}

inline unsigned long long possibleWords(unsigned int pre, unsigned int post)
{
  return (post+1) * (pre+1);
}

int main()
{
  string input;
  cin >> input;

  uint16_t vowelCount = 0;
  uint16_t consonantCount = 0;
  uint16_t prev_idx = 0, idx = 0;
  uint16_t len = input.size();
  uint16_t allWords = 0;

  if (len < 3)
    {
      cout << 0;
      return 0;
    }

  for (char c : input)
    {
      if (isVowel(c))
	{
	  ++vowelCount;
	  consonantCount = 0;
	}
      else
	{
	  ++consonantCount;
	  vowelCount = 0;
	}
      if (vowelCount >= 3 || consonantCount >= 3)
	{
	  allWords += possibleWords(idx-prev_idx-2, len - idx - 1);
	  prev_idx = idx - 1;
	}
      ++idx;
    }

    cout << allWords;
}