//Daniel Grzegorzewski #include <bits/stdc++.h> #pragma GCC optimize("O3") #define MP make_pair #define PB push_back #define ST first #define ND second #define int long long using namespace std; typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<PII> VII; typedef long long LL; void init_ios() { ios_base::sync_with_stdio(0); cin.tie(0); } const int N = 2*(int)1e5 + 10; int n, res; string s; char samo[] = {'a', 'e', 'i', 'o', 'u', 'y'}; bool jest(char c) { for (int i = 0; i < 6; ++i) if (c == samo[i]) return true; return false; } signed main() { init_ios(); cin >> s; n = s.size(); int last = -1; for (int i = 0; i+2 < n; ++i) if ((jest(s[i]) && jest(s[i+1]) && jest(s[i+2])) || (!jest(s[i]) && !jest(s[i+1]) && !jest(s[i+2]))) { res += (i-last)*(n-i-2); last = i; } cout<<res<<"\n"; }
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 | //Daniel Grzegorzewski #include <bits/stdc++.h> #pragma GCC optimize("O3") #define MP make_pair #define PB push_back #define ST first #define ND second #define int long long using namespace std; typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<PII> VII; typedef long long LL; void init_ios() { ios_base::sync_with_stdio(0); cin.tie(0); } const int N = 2*(int)1e5 + 10; int n, res; string s; char samo[] = {'a', 'e', 'i', 'o', 'u', 'y'}; bool jest(char c) { for (int i = 0; i < 6; ++i) if (c == samo[i]) return true; return false; } signed main() { init_ios(); cin >> s; n = s.size(); int last = -1; for (int i = 0; i+2 < n; ++i) if ((jest(s[i]) && jest(s[i+1]) && jest(s[i+2])) || (!jest(s[i]) && !jest(s[i+1]) && !jest(s[i+2]))) { res += (i-last)*(n-i-2); last = i; } cout<<res<<"\n"; } |