#include <iostream> #include <string> #include <vector> #include <map> int main(){ freopen("input.txt","r+",stdin); freopen("output.txt","w",stdout); int nAccounts; std::cin >> nAccounts; std::string accountName; std::getline(std::cin, accountName); std::map<std::string, std::vector<std::string> > account; for (int i = 0; i <nAccounts; i++) { std::string accountName; std::getline(std::cin, accountName); account[accountName].push_back(accountName); } return 0; }
How to go through the vectors in the map and, if the length of the vector is greater than 1, display the key?
Пример входных\выходных данных: 5 abc bdf abc f f Выходные данные: abc f или f abc т.е. порядок вывода не важен.
auto
, otherwise it would completely scare the TSL from STL :) - VladD