#include #include #include using namespace std; int main() { freopen("input.txt", "r", stdin); mapq; string str, last; while (cin >> str){ q[str]++; last = str; } int needCount = q[last]; for (auto it = q.begin(); it != q.end(); it++) { if ((it->second) == needCount) cout << it->first << " "; } }