Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const string pairs = "ae ai ao au ea ee ei eo eu ia ie ii io iu oa oe oi ou ua oo ue ui uu uo";
- map<string, int> fr;
- bool isVowel(char c) {
- return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';
- }
- signed main() {
- //freopen("text.in", "r", stdin);
- string text;
- for (string line; getline(cin, line);) {
- text += line + '\n';
- }
- if (!text.size()) {
- puts(pairs.c_str());
- return 0;
- }
- for (size_t i = 1; i < text.size(); i++) {
- if (isVowel(text[i - 1]) && isVowel(text[i])) {
- string pairOfVowels = string(1, text[i - 1]) + string(1, text[i]);
- fr[pairOfVowels]++;
- }
- }
- int frMax = -1;
- for (const auto &it : fr) {
- frMax = max(frMax, it.second);
- }
- for (const auto &[fi, se] : fr) {
- if (se == frMax) {
- cout << fi << ' ';
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment