/**
Template by Akikaze (秋風) - formerly proptit_4t41.
Code written by a random fan of momocashew and Chiho.
**/
#include <bits/stdc++.h>
using namespace std;
/** -----BASIC MACROES----- **/
#define endl '\n'
#define i64 long long
#define ld long double
#define pub push_back
#define mp make_pair
#define fi first
#define se second
const long long MOD = 1000000007LL, INF = 1e9, LINF = 1e18;
const long double PI = 3.141592653589793116, EPS = 1e-9, GOLD = ((1+sqrt(5))/2);
typedef vector<i64> vi;
typedef vector<ld> vd;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<i64, i64> pii;
typedef pair<i64, pii> pip;
typedef pair<pii, i64> ppi;
/** -----BIT CONTROLS----- **/
template<class T> int getbit(T s, int i) { return (s >> 1) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcount(s); }
/** -----IDEAS/ALGORITHMS-----
Z Algorithm
-------------------------- **/
/** -----CUSTOM TYPEDEFS/DEFINES----- **/
/** -----GLOBAL VARIABLES----- **/
string A, B, BZA;
i64 len; vi Z;
/** -----EXTENSIVE FUNCTIONS----- **/
/** -----COMPULSORY FUNCTIONS----- **/
void VarInput() {
getline(cin, A); getline(cin, B);
// Initialize array to perform Z-Algorithm: string B, then a unique character (which is guaranteed to NOT appear on both strings), then string A.
BZA = B; BZA += "$"; BZA += A;
len = BZA.size();
// Pre-processing Z array
Z.resize(len, 0); Z[0] = -1; // Z[0] initialization just for laughs
i64 x = 0, y = 0; // Keeping track for an interval [x,y] such as the subsequence within these indices is a subsequence of BZA, and y is maximal.
for (i64 i=1; i<len; i++) {
// The rule is, if i + Z[i-x] < y, it is certain that Z[i] = Z[i-x].
// If not, temporarily set Z[i] = y-i+1
Z[i] = max(0LL, min(Z[i-x], y-i+1));
// then iterate until either the new subsequence does not match any longer or y reaches the end of BZA. Remember to update [x,y] interval.
while (i+Z[i] < len && BZA[Z[i]] == BZA[i+Z[i]]) {
x = i; y = i + Z[i]; Z[i]++;
}
}
}
void ProSolve() {
// Iterating through the Z-array
for (i64 i=B.size()+1; i<len; i++) {
if (Z[i] == B.size()) { // Subsequence from index i matches the prefix with the size |B| of BZA, which is the original string B itself
cout << (i-(i64)B.size()) << " ";
}
}
cout << "";
}
/** -----MAIN FUNCTION----- **/
int main() {
//freopen("FILE.INP", "r", stdin);
//freopen("FILE.OUT", "w", stdout);
ios_base::sync_with_stdio(0); cin.tie(NULL);
VarInput(); ProSolve(); return 0;
}