b735ca86c078418989b95b152726c13eee82059c0b5bb5679fa5b5d028ec8054
// tresc: https://szkopul.edu.pl/problemset/problem/MDpNdpKJKp7qp2sovWKfTubf/site/?key=statement
// OIG VI (2 etap)
#include <algorithm>
#include <iostream>
#include <string>
bool isSamogloska(char x) {
return x == 'a' || x == 'e' || x == 'o' || x == 'i' || x == 'y' || x == 'u';
}
bool takieSameKoncowki(std::string& s1, std::string& s2, int k) {
for (int j = 0; j < k; j++) {
if (s1[s1.size() - j - 1] != s2[s2.size() - j - 1]) {
return false;
}
}
return true;
}
int main() {
std::ios_base::sync_with_stdio(0);
std::cin.tie(0);
std::cout.tie(0);
int n, k;
std::cin >> n >> k;
int wynik = 0;
std::string vv;
std::getline(std::cin, vv);
for (int i = 0; i < n; i++) {
std::string s1, s2;
std::getline(std::cin, s1);
std::getline(std::cin, s2);
s1.erase(std::remove_if(s1.begin(), s1.end(), isspace), s1.end());
s2.erase(std::remove_if(s2.begin(), s2.end(), isspace), s2.end());
if (s1.size() < k || s2.size() < k) {
continue;
}
int ls[3]{};
for (int j = 0; j < s1.size(); j++) {
if (isSamogloska(s1[j])) {
ls[1]++;
}
}
for (int j = 0; j < s2.size(); j++) {
if (isSamogloska(s2[j])) {
ls[2]++;
}
}
if (ls[1] == ls[2]) {
if (takieSameKoncowki(s1, s2, k)) {
wynik++;
} else {
continue;
}
} else {
continue;
}
}
std::cout << wynik;
return 0;
}