#include #include const int size = 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]; if (h < 0) h = -h; return h % size; } void main() { string words[size]; cout << "Type some strings.\n"; while (true) { string s; cin >> s; cout << s << " -> " << thing(s) << "\n\n"; } }