#include <cstdio>
typedef long long ll;
const int mlen = (int)2e5 + 10;
const int P = (int)1e9 + 7;
int sn, tn;
char s[mlen], t[mlen];
int main()
{
freopen("substr.in", "r", stdin);
freopen("substr.out", "w", stdout);
int c;
while ((c = getc(stdin)) != '*')
if (c > 32)
s[sn++] = c;
while ((c = getc(stdin)) != -1)
if (c > 32)
t[tn++] = c;
ll hash1 = 0, hash2 = 0, pow = 1;
for (int i = 0; i < sn; i++)
{
hash1 = hash1 * P + s[i];
hash2 = hash2 * P + t[i];
pow *= P;
}
for (int i = 0; i + sn <= tn; i++)
{
if (hash1 == hash2)
printf("%d\n", i + 1);
hash2 = hash2 * P + t[i + sn] - t[i] * pow;
}
return 0;
}