#include<bits/stdc++.h>
using namespace std;
#ifndef d
#define d(...)
#endif
#define st first
#define nd second
#define pb push_back
#define siz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
typedef long long LL;
typedef long double LD;
constexpr int INF=1e9+7;
constexpr LL INFL=1e18;
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
return os << "(" << P.st << "," << P.nd << ")";
}
string s;
vector<char>vowels={'a','e','i','o','u','y'};
bool isVowel[500];
inline bool hard(int i) {
int x=(int)isVowel[s[i]] + (int)isVowel[s[i+1]] + isVowel[s[i+2]];
return (x==0 or x==3);
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
for(auto c:vowels)
isVowel[c]=true;
cin>>s;
int n=siz(s);
LL res=0;
int lst=n;
for(int i=n-1;i>=0;i--) {
if(i<=n-3 and hard(i))
lst=i+2;
res+=max(0,n-lst);
}
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 47 48 49 | #include<bits/stdc++.h> using namespace std; #ifndef d #define d(...) #endif #define st first #define nd second #define pb push_back #define siz(c) (int)(c).size() #define all(c) (c).begin(), (c).end() typedef long long LL; typedef long double LD; constexpr int INF=1e9+7; constexpr LL INFL=1e18; template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) { return os << "(" << P.st << "," << P.nd << ")"; } string s; vector<char>vowels={'a','e','i','o','u','y'}; bool isVowel[500]; inline bool hard(int i) { int x=(int)isVowel[s[i]] + (int)isVowel[s[i+1]] + isVowel[s[i+2]]; return (x==0 or x==3); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); for(auto c:vowels) isVowel[c]=true; cin>>s; int n=siz(s); LL res=0; int lst=n; for(int i=n-1;i>=0;i--) { if(i<=n-3 and hard(i)) lst=i+2; res+=max(0,n-lst); } cout<<res<<"\n"; return 0; } |
English