#include <fstream>
#include <iostream>
#include <string>
#include "Hash.hpp"
int main() {
Hash<std::string, unsigned int> hash(32);
std::string town; unsigned int population;
std::ifstream cities("cities");
while (cities >> town && cities >> population) {
auto [it, ok] = hash.insert(std::make_pair(town, population));
if (!ok) {
std::cerr << "insertion of " << town << " failed." << std::endl;
}
}
while (std::cin >> town) {
auto it = hash.find(town);
if (it == hash.end()) {
std::cerr << town << " not found." << std::endl;
} else {
std::cout << (*it).second << std::endl;
hash.erase(it);
}
}
for (auto& object: hash) {
std::cout << object.first << " " << object.second << std::endl;
}
}