#include #include #include using namespace std; int main() { map countMap; string input; int n; ifstream ifs("class.in"); ifs >> n; int maxCount = 0; int minCount = 1 << 20; for (int ii = 0; ii < n; ++ii) { ifs >> input; map::iterator it = countMap.find(input); int thisCount; if (it == countMap.end()) { countMap.insert(make_pair(input, 1)); thisCount = 1; } else { it->second += 1; thisCount = it->second; } if (maxCount < thisCount) maxCount = thisCount; if (minCount > thisCount) minCount = thisCount; } ofstream ofs("class.out"); ofs << maxCount; ofs << " "; ofs << minCount; return 0; }