#include <iostream>
bool is_vovel[1000]; // samogłoski maja true
char data[200010];
int main() {
long long int total = 0, subtotal = 0;
int num_same = 0;
char prev, cur;
int counter = 0;
is_vovel['a'] = true;
is_vovel['e'] = true;
is_vovel['i'] = true;
is_vovel['o'] = true;
is_vovel['u'] = true;
is_vovel['y'] = true;
cur = 'u';
while (scanf("%c", &cur) != EOF) {
data[counter] = cur;
counter++;
}
int size = counter;
/*std::cout << size << "\n";
for (int i = 0; i < size; ++i)
{
std::cout << data[i];
}
std::cout << "\n";
*/
prev = data[0];
num_same = 1;
subtotal = 0;
for (int i = 1; i < size; ++i) {
cur = data[i];
if (cur != '\n') {
if (is_vovel[cur] == is_vovel[prev]) {
num_same++;
}
else {
num_same = 1;
}
if (num_same >= 3) {
subtotal = i - 1;
}
total += subtotal;
//std::cout << "dla litery " << cur << " total wynosi" << total << "\n";
//printf("litera %c ma kod %d\n", cur, cur);
prev = cur;
}
}
std::cout << total << "\n";
return 0;
}
//„a”, „e”, „i”, „o”, „u” oraz „y”
// w niedziewiedziach scanf
/*a -> 0
ab -> 0
aaabbb -> 7
oaoaoaoaoa -> 36
abcdefghijklmnopqrstuvwxyz -> 272
xd -> 0
latwytest -> 0
trdnytst -> 15
you -> 1
baca -> 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 | #include <iostream> bool is_vovel[1000]; // samogłoski maja true char data[200010]; int main() { long long int total = 0, subtotal = 0; int num_same = 0; char prev, cur; int counter = 0; is_vovel['a'] = true; is_vovel['e'] = true; is_vovel['i'] = true; is_vovel['o'] = true; is_vovel['u'] = true; is_vovel['y'] = true; cur = 'u'; while (scanf("%c", &cur) != EOF) { data[counter] = cur; counter++; } int size = counter; /*std::cout << size << "\n"; for (int i = 0; i < size; ++i) { std::cout << data[i]; } std::cout << "\n"; */ prev = data[0]; num_same = 1; subtotal = 0; for (int i = 1; i < size; ++i) { cur = data[i]; if (cur != '\n') { if (is_vovel[cur] == is_vovel[prev]) { num_same++; } else { num_same = 1; } if (num_same >= 3) { subtotal = i - 1; } total += subtotal; //std::cout << "dla litery " << cur << " total wynosi" << total << "\n"; //printf("litera %c ma kod %d\n", cur, cur); prev = cur; } } std::cout << total << "\n"; return 0; } //„a”, „e”, „i”, „o”, „u” oraz „y” // w niedziewiedziach scanf /*a -> 0 ab -> 0 aaabbb -> 7 oaoaoaoaoa -> 36 abcdefghijklmnopqrstuvwxyz -> 272 xd -> 0 latwytest -> 0 trdnytst -> 15 you -> 1 baca -> 0 */ |
English