for (int i = 0; i < orders.size(); i++) { sort(orders[i].begin(), orders[i].end()); makeAllCourse("", orders[i], 0); } for (auto iter = m.begin(); iter != m.end(); iter++) { int courseCount = iter->first.length(); maxValues[courseCount] = max(maxValues[courseCount], iter->second); } for (auto iter = m.begin(); iter != m.end(); iter++) { int courseCount = iter->first.length();
if (iter->second == maxValues[courseCount] && iter->second >= 2) { for (int i = 0; i < course.size(); i++) { if (courseCount == course[i]) { answer.push_back(iter->first); } } } } return answer; }