#include<iostream> #include<vector> #include<map> #include<set> #include<unordered_map> #include<algorithm> #include<bitset> #include<queue> #include <math.h> #define ll long long #define ld long double #define ull unsigned long long #define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout.precision(10);cout << fixed; #define dbset(x) for(int i=0 ; i<x.size(); i++) cerr << x[i] << " "; cerr << endl; #define inf 1000000007 #define INF 1000000000000000000LL #define PI 3.14159265358979323846 #define mod 1000000007 #define mod1 1000696969 #define flusz fflush(stdout); #define VI vector<int> #define VPI vector < pair<int,int> > #define PII pair<int, int> #define PIII pair<pair<int,int>,int> #define BIT bitset<N> #define st first #define nd second #define pb push_back #define mp make_pair #define eb emplace_back #define M (L+R)/2 #define endl '\n' #define REP(x, y) for(int x = 0; x < (y); ++x) #define FOR(x, y, z) for(int x = y; x <= (z); ++x) #define FORR(x, y, z) for(int x = y; x >= (z); --x) using namespace std; template<class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";} template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) { while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<","; _dbg(sdbg+1, a...); } #define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__) #define int long long const int N = 1000*1000 + 7; int test; int n, res; string s; char cc[] = {'a', 'e', 'i', 'o', 'u', 'y'}; void solve() { cin >> s; int b = 0, c = 0; n = s.size(); FOR(i,2,n-1){ int a = 0; REP(j,3){ int czy = 0; REP(l,6){ if (s[i-j] == cc[l]) czy = 1; } a += czy; } if (a == 0 || a == 3){ b = i - 2; c = 1; } if (c == 1){ res += b + 1; } } cout << res; return; } int32_t main() { boost test=1; for(int i=1; i <= test; i++){ solve(); } 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 | #include<iostream> #include<vector> #include<map> #include<set> #include<unordered_map> #include<algorithm> #include<bitset> #include<queue> #include <math.h> #define ll long long #define ld long double #define ull unsigned long long #define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout.precision(10);cout << fixed; #define dbset(x) for(int i=0 ; i<x.size(); i++) cerr << x[i] << " "; cerr << endl; #define inf 1000000007 #define INF 1000000000000000000LL #define PI 3.14159265358979323846 #define mod 1000000007 #define mod1 1000696969 #define flusz fflush(stdout); #define VI vector<int> #define VPI vector < pair<int,int> > #define PII pair<int, int> #define PIII pair<pair<int,int>,int> #define BIT bitset<N> #define st first #define nd second #define pb push_back #define mp make_pair #define eb emplace_back #define M (L+R)/2 #define endl '\n' #define REP(x, y) for(int x = 0; x < (y); ++x) #define FOR(x, y, z) for(int x = y; x <= (z); ++x) #define FORR(x, y, z) for(int x = y; x >= (z); --x) using namespace std; template<class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";} template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) { while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<","; _dbg(sdbg+1, a...); } #define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__) #define int long long const int N = 1000*1000 + 7; int test; int n, res; string s; char cc[] = {'a', 'e', 'i', 'o', 'u', 'y'}; void solve() { cin >> s; int b = 0, c = 0; n = s.size(); FOR(i,2,n-1){ int a = 0; REP(j,3){ int czy = 0; REP(l,6){ if (s[i-j] == cc[l]) czy = 1; } a += czy; } if (a == 0 || a == 3){ b = i - 2; c = 1; } if (c == 1){ res += b + 1; } } cout << res; return; } int32_t main() { boost test=1; for(int i=1; i <= test; i++){ solve(); } return 0; } |