#include <bits/stdc++.h> using namespace std; int n; string text; set<char> samogloski; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> text; n = text.size(); for (int x = 0; x != n; x++) { if (text[x] == 'a' || text[x] == 'e' || text[x] == 'y' || text[x] == 'u' || text[x] == 'i' || text[x] == 'o') text[x] = '0'; else text[x] = '1'; } //cout << text << "\n"; for (int x = 0; x != n - 2; x++) { if (text[x] == text[x + 1] && text[x] == text[x+2]) text[x] = '1'; else text[x] = '0'; } text[n - 2] = '0'; text[n - 1] = '0'; int add = 0; long long answer = 0; for (int x = 0; x != n - 2; x++) { if (text[x] == '1') add = x + 1; answer += add; } //cout << text << "\n"; cout << answer << "\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 | #include <bits/stdc++.h> using namespace std; int n; string text; set<char> samogloski; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> text; n = text.size(); for (int x = 0; x != n; x++) { if (text[x] == 'a' || text[x] == 'e' || text[x] == 'y' || text[x] == 'u' || text[x] == 'i' || text[x] == 'o') text[x] = '0'; else text[x] = '1'; } //cout << text << "\n"; for (int x = 0; x != n - 2; x++) { if (text[x] == text[x + 1] && text[x] == text[x+2]) text[x] = '1'; else text[x] = '0'; } text[n - 2] = '0'; text[n - 1] = '0'; int add = 0; long long answer = 0; for (int x = 0; x != n - 2; x++) { if (text[x] == '1') add = x + 1; answer += add; } //cout << text << "\n"; cout << answer << "\n"; return 0; } |