//#pragma GCC optimize("Ofast") //#pragma GCC optimize ("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma warning(disable:4786) #pragma warning(disable:4996) #include <ctime> #include<list> #include <numeric> #include<bitset> #include<iostream> #include<cstdio> #include<algorithm> #include<vector> #include<set> #include<map> #include<functional> #include<string> #include<cstring> #include<cstdlib> #include<queue> #include<utility> #include<fstream> #include<sstream> #include<cmath> #include<stack> #include<assert.h> #include<unordered_map> #include<unordered_set> using namespace std; #define MEM(a, b) memset(a, (b), sizeof(a)) #define CLR(a) memset(a, 0, sizeof(a)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) ) #define S(X) ( (X) * (X) ) #define SZ(V) (int )V.size() #define FORN(i, n) for(int i = 0; i < n; i++) #define FORAB(i, a, b) for(int i = a; i <= b; i++) #define ALL(V) V.begin(), V.end() #define IN(A, B, C) ((B) <= (A) && (A) <= (C)) #define AIN(A, B, C) assert(IN(A, B, C)) //typedef int LL; typedef long long int LL; //typedef __int128 LL; //typedef __int64 LL; typedef pair<int, int> PII; typedef pair<LL, LL> PLL; typedef pair<long double, long double> PDD; typedef vector<int> VI; typedef vector<LL> VL; typedef vector<PII > VP; typedef vector<double> VD; typedef vector<LL> VL; typedef long double ld; char S[200005]; inline int IsVowel(char ch) { return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' || ch == 'y'; } int mark[200005], nxtMark[200005]; void solve() { scanf("%s", S); int len = strlen(S); for (int i = 0; i < len; i++) { S[i] = IsVowel(S[i]); } for (int i = 0; i < len; i++) { mark[i] = (i + 2 < len && S[i] == S[i + 1] && S[i] == S[i + 2]); } nxtMark[len] = len; for (int i = len - 1; i >= 0; i--) { nxtMark[i] = nxtMark[i + 1]; if (mark[i]) nxtMark[i] = i; } LL ans = 0; for (int i = 0; i < len; i++) { if (nxtMark[i] == len) continue; ans += len - (nxtMark[i] + 2); } printf("%lld\n", ans); } int main() { #ifdef LOCAL double start_time = clock(); freopen("C:\\Home\\ContestCodes\\sample.in", "r", stdin); // freopen("out.out", "w", stdout); #endif solve(); #ifdef LOCAL double end_time = clock(); fprintf(stderr, "Time = %lf\n", (end_time - start_time) / CLOCKS_PER_SEC); #endif 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 | //#pragma GCC optimize("Ofast") //#pragma GCC optimize ("unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma warning(disable:4786) #pragma warning(disable:4996) #include <ctime> #include<list> #include <numeric> #include<bitset> #include<iostream> #include<cstdio> #include<algorithm> #include<vector> #include<set> #include<map> #include<functional> #include<string> #include<cstring> #include<cstdlib> #include<queue> #include<utility> #include<fstream> #include<sstream> #include<cmath> #include<stack> #include<assert.h> #include<unordered_map> #include<unordered_set> using namespace std; #define MEM(a, b) memset(a, (b), sizeof(a)) #define CLR(a) memset(a, 0, sizeof(a)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) ) #define S(X) ( (X) * (X) ) #define SZ(V) (int )V.size() #define FORN(i, n) for(int i = 0; i < n; i++) #define FORAB(i, a, b) for(int i = a; i <= b; i++) #define ALL(V) V.begin(), V.end() #define IN(A, B, C) ((B) <= (A) && (A) <= (C)) #define AIN(A, B, C) assert(IN(A, B, C)) //typedef int LL; typedef long long int LL; //typedef __int128 LL; //typedef __int64 LL; typedef pair<int, int> PII; typedef pair<LL, LL> PLL; typedef pair<long double, long double> PDD; typedef vector<int> VI; typedef vector<LL> VL; typedef vector<PII > VP; typedef vector<double> VD; typedef vector<LL> VL; typedef long double ld; char S[200005]; inline int IsVowel(char ch) { return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' || ch == 'y'; } int mark[200005], nxtMark[200005]; void solve() { scanf("%s", S); int len = strlen(S); for (int i = 0; i < len; i++) { S[i] = IsVowel(S[i]); } for (int i = 0; i < len; i++) { mark[i] = (i + 2 < len && S[i] == S[i + 1] && S[i] == S[i + 2]); } nxtMark[len] = len; for (int i = len - 1; i >= 0; i--) { nxtMark[i] = nxtMark[i + 1]; if (mark[i]) nxtMark[i] = i; } LL ans = 0; for (int i = 0; i < len; i++) { if (nxtMark[i] == len) continue; ans += len - (nxtMark[i] + 2); } printf("%lld\n", ans); } int main() { #ifdef LOCAL double start_time = clock(); freopen("C:\\Home\\ContestCodes\\sample.in", "r", stdin); // freopen("out.out", "w", stdout); #endif solve(); #ifdef LOCAL double end_time = clock(); fprintf(stderr, "Time = %lf\n", (end_time - start_time) / CLOCKS_PER_SEC); #endif return 0; } |