#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <cstdlib> #include <vector> #include <algorithm> #include <cstring> #include <string> #include <map> #include <deque> using namespace std; typedef long long LL; typedef pair<int,int> PI; typedef vector<int> VI; #define ALL(a) (a).begin(),(a).end() #define PB push_back #define MP make_pair #define FT first #define SD second #define Y first #define X second vector<string>token(string a) { vector<string>w;a.push_back(' '); while(!a.empty()){w.push_back(a.substr(0,a.find(" ")));a=a.substr(a.find(" ")+1,a.size()-1);}return w; } map<string,int> mapik; vector<string> amapik; int dodaj(string a) {if(mapik.count(a)==0) {mapik[a]=mapik.size()-1;amapik.PB(a);}return mapik[a];} const int INF = 1000000000; const LL INFINF = 1000000000000000000LL; PI moves4[4] = { MP(1, 0), MP(-1, 0), MP(0, 1), MP(0, -1) }; PI move(PI st, PI m) { return MP(st.first + m.first, st.second + m.second); } int rows, cols; bool on_board(PI p) { return p.first >= 0 && p.second >= 0 && p.first < rows && p.second < cols; } char tmp_str[1000000]; string scanf_string() { scanf("%s",tmp_str); return tmp_str; } inline bool get_bit(int w, int i) { return (w>>i)&1; } // ========================================================== const int N = 1000000; int n; string dane; bool sam[300]; int main() { dane = scanf_string(); n = dane.size(); sam['a']=sam['e']=sam['y']=sam['u']=sam['i']=sam['o']=1; LL res = 0; int trudny = n-2; for(int i=n-3;i>=0;i--) { if(sam[dane[i]] == sam[dane[i+1]] && sam[dane[i]] == sam[dane[i+2]]) trudny = i; res += n - 2 - trudny; } printf("%lld\n", 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 | #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <cstdlib> #include <vector> #include <algorithm> #include <cstring> #include <string> #include <map> #include <deque> using namespace std; typedef long long LL; typedef pair<int,int> PI; typedef vector<int> VI; #define ALL(a) (a).begin(),(a).end() #define PB push_back #define MP make_pair #define FT first #define SD second #define Y first #define X second vector<string>token(string a) { vector<string>w;a.push_back(' '); while(!a.empty()){w.push_back(a.substr(0,a.find(" ")));a=a.substr(a.find(" ")+1,a.size()-1);}return w; } map<string,int> mapik; vector<string> amapik; int dodaj(string a) {if(mapik.count(a)==0) {mapik[a]=mapik.size()-1;amapik.PB(a);}return mapik[a];} const int INF = 1000000000; const LL INFINF = 1000000000000000000LL; PI moves4[4] = { MP(1, 0), MP(-1, 0), MP(0, 1), MP(0, -1) }; PI move(PI st, PI m) { return MP(st.first + m.first, st.second + m.second); } int rows, cols; bool on_board(PI p) { return p.first >= 0 && p.second >= 0 && p.first < rows && p.second < cols; } char tmp_str[1000000]; string scanf_string() { scanf("%s",tmp_str); return tmp_str; } inline bool get_bit(int w, int i) { return (w>>i)&1; } // ========================================================== const int N = 1000000; int n; string dane; bool sam[300]; int main() { dane = scanf_string(); n = dane.size(); sam['a']=sam['e']=sam['y']=sam['u']=sam['i']=sam['o']=1; LL res = 0; int trudny = n-2; for(int i=n-3;i>=0;i--) { if(sam[dane[i]] == sam[dane[i+1]] && sam[dane[i]] == sam[dane[i+2]]) trudny = i; res += n - 2 - trudny; } printf("%lld\n", res); return 0; } |