#include #include #include using namespace std; const int size = 40000; string data[size]; int hash(string s) { int value = 79561; for (int i = 0; i < s.length(); i += 1) value = value * 69 + s[i]; if (value < 0) value = - value; return value % size; } int main() { while (true) { string s; cin >> s; if (cin.fail()) break; int pos = hash(s); cout << s << ": " << pos << ": @" << data[pos] << "@\n"; data[pos] = s; } }