#include "bits/stdc++.h"
 
using namespace std;
 
struct characters
{
    static int const size = 62;
    static int convert(char c)
    {
        // assert('a' <= c && c <= 'z');
        if ('a' <= c && c <= 'z')
        {
            return c - 'a';
        }
        else if ('A' <= c && c <= 'Z')
        {
            return 26 + c - 'A';
        }
        else
        {
            return 52 + c - '0';
        }
    }
    static char invert(int i)
    {
        // assert(0 <= i && i < size);
        if (0 <= i && i < 26)
        {
            return 'a' + i;
        }
        else if (26 <= i && i < 52)
        {
            return 'A' + i - 26;
        }
        else
        {
            return '0' + i - 52;
        }
    }
};
 
template <typename Characters>
class AhoCorasick
{
    static constexpr int invalidIndex = -1;
 
    struct PMA
    {
        int fail;
        std::vector<int> next, accept;
 
        PMA() : fail(invalidIndex), next(Characters::size, invalidIndex) {}
    };
 
    const int K;
    std::vector<PMA*> nodes;
 
    int transition(int nodeIndex, char cc)
    {
        assert(0 <= nodeIndex && nodeIndex < (int)nodes.size());
        int c = Characters::convert(cc);
        int now = nodeIndex;
        while (nodes[now]->next[c] == invalidIndex && now != 0)
        {
            now = nodes[now]->fail;
        }
        now = nodes[now]->next[c];
        if (now == invalidIndex)
            now = 0;
        return now;
    }
 
  public:
    AhoCorasick(const std::vector<std::string> &ts) : K((int)ts.size())
    {
        const int rootIndex = 0;
        // root node
        nodes.push_back(new PMA);
        nodes[rootIndex]->fail = rootIndex;
        for (int i = 0; i < K; i++)
        {
            int now = rootIndex;
            for (auto cs : ts[i])
            {
                int c = Characters::convert(cs);
                if (nodes[now]->next[c] == invalidIndex)
                {
                    nodes[now]->next[c] = (int)nodes.size();
                    nodes.push_back(new PMA);
                }
                now = nodes[now]->next[c];
            }
            nodes[now]->accept.push_back(i);
        }
 
        std::queue<int> que;
        for (int c = 0; c < Characters::size; c++)
        {
            if (nodes[rootIndex]->next[c] != invalidIndex)
            {
                nodes[nodes[rootIndex]->next[c]]->fail = rootIndex;
                que.push(nodes[rootIndex]->next[c]);
            }
        }
        while (!que.empty())
        {
            int now = que.front();
            que.pop();
            for (int c = 0; c < Characters::size; c++)
            {
                if (nodes[now]->next[c] != invalidIndex)
                {
                    que.push(nodes[now]->next[c]);
                    int nxt = transition(nodes[now]->fail, Characters::invert(c));
                    nodes[nodes[now]->next[c]]->fail = nxt;
                    for (auto ac : nodes[nxt]->accept)
                    {
                        nodes[nodes[now]->next[c]]->accept.push_back(ac);
                    }
                }
            }
        }
    }
    std::vector<std::vector<int>> match(const std::string &str)
    {
        std::vector<std::vector<int>> ret(K);
        int now = 0;
        for (int i = 0; i < (int)str.size(); i++)
        {
            now = transition(now, str[i]);
            for (auto k : nodes[now]->accept)
            {
                ret[k].push_back(i);
            }
        }
        return ret;
    }
};
 
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    string T, P;
    cin >> T >> P;
    vector<string> s;
    s.push_back(P);
    AhoCorasick<characters> ac(s);
    auto ret = ac.match(T);
    for (auto i : ret[0])
        cout << i - (int)P.size() + 1 << endl;
}


Measured memory_bytes: 11944