Skip to content

Instantly share code, notes, and snippets.

@invatainfo
Last active February 15, 2020 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save invatainfo/d17ef9fd4fe414b2e353c333f895c08e to your computer and use it in GitHub Desktop.
Save invatainfo/d17ef9fd4fe414b2e353c333f895c08e to your computer and use it in GitHub Desktop.
#include <fstream>
#include <iostream>
#include <string.h>
using namespace std;
ifstream fin("text.in");
char v[] = "aeiou";
int f[5][5]; // f[0][0] e pt aa, f[3][4] e pt ou, etc
int main() {
char x, y;
fin >> x;
while (fin.get(y)) {
if (strchr(v, x) && strchr(v, y))
f[strchr(v, x) - v][strchr(v, y) - v]++;
x = y;
}
int i, j, max = 0;
for (i = 0; i <= 4; i++) {
for (j = 0; j <= 4; j++) {
if (f[i][j] > max) {
max = f[i][j];
}
}
}
for (i = 0; i <= 4; i++) {
for (j = 0; j <= 4; j++) {
if (f[i][j] == max) {
cout << v[i] << v[j] << endl;
}
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment