#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef long double LD; typedef pair < int, int > PII; typedef pair < LL, LL > PLL; typedef pair < LD, LD > PDD; #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() #define st first #define nd second #define pb push_back #define REP(i,a,b) for(int i = (a); i <= (b); i++) #define FOR(i, n) REP(i, 0, int(n) - 1) #define pii pair < int, int > #define ll long long #define fi first #define se second #define mp make_pair #define vi vector <int> char vowels[6] = {'a','e','i','o','u','y'}; bool vowel(char c) { FOR(i,6) if(c == vowels[i]) return 1; return 0; } int main() { ios_base::sync_with_stdio(0); string s; cin>>s; int n = s.size(), pre = -1; ll res = 0; REP(i,2,n-1) { bool ok = 1; REP(j,1,2) if(vowel(s[i-j]) != vowel(s[i])) ok = 0; if(ok) pre = i-2; if(pre >= 0) res += pre + 1; } cout<<res<<"\n"; 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 | #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef long double LD; typedef pair < int, int > PII; typedef pair < LL, LL > PLL; typedef pair < LD, LD > PDD; #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() #define st first #define nd second #define pb push_back #define REP(i,a,b) for(int i = (a); i <= (b); i++) #define FOR(i, n) REP(i, 0, int(n) - 1) #define pii pair < int, int > #define ll long long #define fi first #define se second #define mp make_pair #define vi vector <int> char vowels[6] = {'a','e','i','o','u','y'}; bool vowel(char c) { FOR(i,6) if(c == vowels[i]) return 1; return 0; } int main() { ios_base::sync_with_stdio(0); string s; cin>>s; int n = s.size(), pre = -1; ll res = 0; REP(i,2,n-1) { bool ok = 1; REP(j,1,2) if(vowel(s[i-j]) != vowel(s[i])) ok = 0; if(ok) pre = i-2; if(pre >= 0) res += pre + 1; } cout<<res<<"\n"; return 0; } |