#include #include const int maxx = 10000; int thing(string s) { int h = 278361; const int len = s.length(); for (int i = 0; i < len; i += 1) h = h * 69 + s[i]; return h % maxx; } void main() { cout << "Type some strings.\n"; while (true) { string s; cin >> s; if (cin.eof()) break; int i = thing(s); cout << s << " -> " << i << "\n\n"; } }