/// Author : Nguyễn Thái Sơn - K18 - KHMT - UIT
/// Training ICPC 2024
#include<bits/stdc++.h>
/// #pragma GCC optimize("O3,unroll-loops")
/// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define fi first
#define se second
#define TASK "test"
#define pb push_back
#define EL cout << endl
#define Ti20_ntson int main()
#define in(x) cout << x << endl
#define all(x) (x).begin(),(x).end()
#define getbit(x, i) (((x) >> (i)) & 1)
#define cntbit(x) __builtin_popcount(x)
#define FOR(i,l,r) for (int i = l; i <= r; i++)
#define FORD(i,l,r) for (int i = l; i >= r; i--)
#define Debug(a,n) for (int i = 1; i <= n; i++) cout << a[i] << " "; cout << endl
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> vii;
typedef unsigned long long ull;
typedef vector<vector<int>> vvi;
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
const int N = 1e6 + 5;
const int oo = INT_MAX;
const int mod = 1e9 + 7;
const int d4x[4] = {-1, 0, 1, 0} , d4y[4] = {0, 1, 0, -1};
const int d8x[8] = {-1, -1, 0, 1, 1, 1, 0, -1}, d8y[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int base = 31;
const long long nmod = 1ll * mod * mod;
string s, t;
int ns, nt;
long long Hash[N], Pow[N], HashT;
int Get(int l, int r) {
/// Hash[r] - Hash[l - 1] * Base ^ (r - l + 1)
/// abcd
/// a ab abc abcd
/// 1 2 3 4
/// [l = 2, r = 4] = abcd - a * base ^ 3 = s[4] - s[1] * base ^ (4 - 2 + 1)
/// 942 - 9 * (10 ^ 2) = 942 - 900
/// Pow[i] = Base ^ i
return (Hash[r] - Hash[l - 1] * Pow[r - l + 1] + nmod) % mod;
}
inline void Read_Input() {
cin >> s >> t;
ns = s.size();
nt = t.size();
s = ' ' + s;
t = ' ' + t;
/// Pow[i] = Base ^ i
Pow[0] = 1;
for (int i = 1; i <= ns; i++)
Pow[i] = Pow[i - 1] * base % mod;
/// Hash[i] = Bieu dien cua doan s[1, i]
for (int i = 1; i <= ns; i++)
Hash[i] = (Hash[i - 1] * base + s[i] - 'a' + 1) % mod;
for (int i = 1; i <= nt; i++)
HashT = (HashT * base + t[i] - 'a' + 1) % mod;
}
inline void Solve() {
for (int i = 1; i <= ns - nt + 1; i++) {
if (Get(i, i + nt - 1) == HashT) cout << i << " ";
}
}
Ti20_ntson {
// freopen(TASK".INP","r",stdin);
// freopen(TASK".OUT","w",stdout);
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int T = 1;
// cin >> T;
while (T -- ) {
Read_Input();
Solve();
}
}
Ly8vIEF1dGhvciA6IE5ndXnhu4VuIFRow6FpIFPGoW4gLSBLMTggLSBLSE1UIC0gVUlUCi8vLyBUcmFpbmluZyBJQ1BDIDIwMjQKCiNpbmNsdWRlPGJpdHMvc3RkYysrLmg+CgovLy8gI3ByYWdtYSBHQ0Mgb3B0aW1pemUoIk8zLHVucm9sbC1sb29wcyIpCi8vLyAjcHJhZ21hIEdDQyB0YXJnZXQoImF2eDIsYm1pLGJtaTIsbHpjbnQscG9wY250IikKCiNkZWZpbmUgZmkgZmlyc3QKI2RlZmluZSBzZSBzZWNvbmQKI2RlZmluZSBUQVNLICJ0ZXN0IgojZGVmaW5lIHBiIHB1c2hfYmFjawojZGVmaW5lIEVMIGNvdXQgPDwgZW5kbAojZGVmaW5lIFRpMjBfbnRzb24gaW50IG1haW4oKQojZGVmaW5lIGluKHgpIGNvdXQgPDwgeCA8PCBlbmRsCiNkZWZpbmUgYWxsKHgpICh4KS5iZWdpbigpLCh4KS5lbmQoKQojZGVmaW5lIGdldGJpdCh4LCBpKSAoKCh4KSA+PiAoaSkpICYgMSkKI2RlZmluZSBjbnRiaXQoeCkgX19idWlsdGluX3BvcGNvdW50KHgpCiNkZWZpbmUgRk9SKGksbCxyKSBmb3IgKGludCBpID0gbDsgaSA8PSByOyBpKyspCiNkZWZpbmUgRk9SRChpLGwscikgZm9yIChpbnQgaSA9IGw7IGkgPj0gcjsga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