Untitled
unknown
c_cpp
3 years ago
541 B
5
Indexable
#include <iostream>
#include <vector>
using namespace std;
int main() {
int k, t, match = 1;
cin >> k >> t;
string poem[k];
getline(cin, poem[0]);
for (int i = 0; i < k; i++) {
getline(cin, poem[i]);
}
for (int i = 0; i < k - 1; i++) {
int cur_match = 1;
for (int j = i + 1; j < k; j++) {
if (poem[i].substr(poem[i].length() - t) == poem[j].substr(poem[j].length() - t)) ++cur_match;
}
match = max(match, cur_match);
}
cout << match;
return 0;
}Editor is loading...