#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING #define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS #include <bits/stdc++.h> using namespace std; #define LSB(i) ((i) & -(i)) // zeroes all the bits except the least significant one #define F first #define S second #define PB push_back #define BOOST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ALL(i) begin((i)), end((i)) typedef long long LL; typedef unsigned long long ULL; typedef pair<int, int> PII; typedef vector < int > VI; typedef long double LD; typedef pair<LL, LL> PLL; typedef vector<PII> VII; template <class T, class U> istream& operator>>(istream& st, pair<T, U> & p) { st >> p.first >> p.second; return st; } template <class T, class U> ostream& operator<<(ostream& st, pair<T, U> p) { st << p.first << ' ' << p.second; return st; } template<class T, class U, class V> pair<T, U> operator* (pair<T, U>p, V val) { return{ p.first * val, p.second * val }; } template<class T, class U, class V> pair<T, U> operator/ (pair<T, U>p, V val) { return{ p.first / val, p.second / val }; } template<class T, class U> pair<T, U> operator- (pair<T, U> a, pair<T, U> b) { return{ a.first - b.first, a.second - b.second }; } template<class T, class U> pair<T, U> operator+ (pair<T, U> a, pair<T, U> b) { return{ a.first + b.first, a.second + b.second }; } template<class T> T dotProduct(pair < T, T> a, pair < T, T> b) { return a.first*b.first + a.second* b.second; } template<class T> T crossProduct(pair<T, T >a, pair<T, T> b) { return a.first * b.second - a.second * b.first; } template<class T> T lengthPow(pair<T, T> a) { return a.first*a.first + a.second*a.second; } template<class T> LD length(pair<T, T> a) { return sqrt(lengthPow(a)); } const int N = (int)4e6 + 57, inf = (int)1e9 + 7; const LL MOD = (LL)1e9 + 7; const LL INF = (LL)1e18 + 7; const int M = 1 << 22; const long double PI = acos(-1); const LD EPS = 1e-12; bool jestSamo(char c) { return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'y'; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); string s; cin >> s; if (s.size() < 3) { cout << 0; return 0; } bool a = jestSamo(s[0]); bool b = jestSamo(s[1]); LL ostatnie = 0; LL res = 0; for (long long i = 2; i < s.size(); ++i) { bool c = jestSamo(s[i]); if (b == c && b == a) { res += (s.size() - i) * (i - ostatnie-1); ostatnie = i - 1; } a = b; b = c; } cout << res; return 0; }
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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | #define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING #define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS #include <bits/stdc++.h> using namespace std; #define LSB(i) ((i) & -(i)) // zeroes all the bits except the least significant one #define F first #define S second #define PB push_back #define BOOST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ALL(i) begin((i)), end((i)) typedef long long LL; typedef unsigned long long ULL; typedef pair<int, int> PII; typedef vector < int > VI; typedef long double LD; typedef pair<LL, LL> PLL; typedef vector<PII> VII; template <class T, class U> istream& operator>>(istream& st, pair<T, U> & p) { st >> p.first >> p.second; return st; } template <class T, class U> ostream& operator<<(ostream& st, pair<T, U> p) { st << p.first << ' ' << p.second; return st; } template<class T, class U, class V> pair<T, U> operator* (pair<T, U>p, V val) { return{ p.first * val, p.second * val }; } template<class T, class U, class V> pair<T, U> operator/ (pair<T, U>p, V val) { return{ p.first / val, p.second / val }; } template<class T, class U> pair<T, U> operator- (pair<T, U> a, pair<T, U> b) { return{ a.first - b.first, a.second - b.second }; } template<class T, class U> pair<T, U> operator+ (pair<T, U> a, pair<T, U> b) { return{ a.first + b.first, a.second + b.second }; } template<class T> T dotProduct(pair < T, T> a, pair < T, T> b) { return a.first*b.first + a.second* b.second; } template<class T> T crossProduct(pair<T, T >a, pair<T, T> b) { return a.first * b.second - a.second * b.first; } template<class T> T lengthPow(pair<T, T> a) { return a.first*a.first + a.second*a.second; } template<class T> LD length(pair<T, T> a) { return sqrt(lengthPow(a)); } const int N = (int)4e6 + 57, inf = (int)1e9 + 7; const LL MOD = (LL)1e9 + 7; const LL INF = (LL)1e18 + 7; const int M = 1 << 22; const long double PI = acos(-1); const LD EPS = 1e-12; bool jestSamo(char c) { return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'y'; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); string s; cin >> s; if (s.size() < 3) { cout << 0; return 0; } bool a = jestSamo(s[0]); bool b = jestSamo(s[1]); LL ostatnie = 0; LL res = 0; for (long long i = 2; i < s.size(); ++i) { bool c = jestSamo(s[i]); if (b == c && b == a) { res += (s.size() - i) * (i - ostatnie-1); ostatnie = i - 1; } a = b; b = c; } cout << res; return 0; } |