#include <bits/stdc++.h>
using namespace std;
void DAU(const string &task = "") {
if (!task.empty())
freopen((task + ".in").c_str(), "r", stdin),
freopen((task + ".out").c_str(), "w", stdout);
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
}
void PLEC() {
exit(0);
}
const int N(2e6 + 5);
inline void LSP(char *s, int* lsp) {
int j(0);
lsp[0] = 0;
for (size_t i = 1; i < strlen(s); ++i) {
while (j > 0 && s[i] != s[j])
j = lsp[j - 1];
if (s[i] == s[j])
++j;
lsp[i] = j;
}
}
int lsp[N];
inline void KMP(char *text, char *pat) {
int i(0), j(0), nt(static_cast<int>(strlen(text))), np(static_cast<int>(strlen(pat)));
vector<int> res;
LSP(pat, lsp);
while (i < nt) {
if (text[i] == pat[j])
++i, ++j;
else {
if (!j) ++i;
else j = lsp[j - 1];
}
if (j == np) {
res.emplace_back(i - np);
j = lsp[j - 1];
}
}
int afis = 0;
cout << res.size() << '\n';
for (const int &x : res) {
cout << x << ' ';
if (++afis == 1000)
break;
}
}
char a[N], b[N];
signed main() {
DAU("strmatch");
cin >> a >> b;
KMP(b, a);
PLEC();
}