Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #define LENGTH 300
- int dif(char p){
- if (p == 'a' || p == 'e' || p == 'i' || p == 'o' || p == 'u' || p == 'y')
- return 1;
- return 0;
- }
- int length(char a[][LENGTH], int line){
- int cnt;
- for (cnt = 0; a[line][cnt] != '\0'; ++cnt);
- return cnt;
- }
- using namespace std;
- int main() {
- ifstream fin("input.txt");
- ofstream fout("output.txt");
- int N;
- fin >> N;
- char word[N][LENGTH];
- int cnt[N];
- for (int i = 0; i < N; ++i)
- cnt[i] = 0;
- int maxx = 0;
- for (int i = 0; i < N; ++i) {
- fin >> word[i];
- int len = length(word, i);
- word[i][len + 1] = '0';
- word[i][len + 2] = '\0';
- for (int j = len; j > 0; --j)
- word[i][j] = word[i][j-1];
- word[i][0] = '0';
- for (int j = 3; j < len + 2; ++j) {
- if (!dif(word[i][j]) && !dif(word[i][j-3]) && dif(word[i][j-1]) && dif(word[i][j-2])){
- cnt[i]++;
- }
- }
- maxx = cnt[i] > maxx ? cnt[i] : maxx;
- }
- for (int i = 0; i < N; ++i) {
- if (cnt[i] == maxx) {
- for (int j = 1; word[i][j]; ++j) {
- if (word[i][j] != '0'){
- fout << word[i][j];
- }
- }
- fout << endl;
- }
- }
- fin.close();
- fout.close();
- return 0;
- }
Add Comment
Please, Sign In to add comment