#include #include #include #include using namespace std; int const x = 821, p = 999999937; vector findRabinKarp (string s, string t) { vector res; int m = s.size (), n = t.size (); int hs = 0, ht = 0, xm = 1; for (int j = 0; j < m; j++) { hs = (hs * 1LL * x + s[j]) % p; xm = (xm * 1LL * x) % p; } for (int i = 0; i < n; i++) { ht = (ht * 1LL * x + t[i]) % p; if (i >= m) { ht = (ht - t[i - m] * 1LL * xm) % p; if (ht < 0) ht += p; } if (ht == hs) res.push_back (i - m + 2); } return res; } int main () { string s, t; cin >> s >> t; vector res = findRabinKarp (s, t); if (res.empty ()) cout << "none"; else copy (res.begin (), res.end (), ostream_iterator (cout, " ")); return 0; }