#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

class RollingHash {
    const ll base = 9973;
    const vector <ll> mod = {999999937LL, 1000000007LL};
    string S;
    vector <ll> hash[2], pow[2];

public:
    RollingHash(const string &s) {
        S = s;
        int n = S.size();
        for (int i = 0; i < 2; i++) {
            hash[i].assign(n + 1, 0);
            pow[i].assign(n + 1, 1);
            for (int j = 0; j < n; j++) {
                hash[i][j + 1] = (hash[i][j] * base + S[j]) % mod[i];
                pow[i][j + 1] = pow[i][j] * base % mod[i];
            }
        }
    }

    // get hash of [l:r)
    ll get(int l, int r, int id = 0) {
        ll res = hash[id][r] - hash[id][l] * pow[id][r - l] % mod[id];
        if (res < 0) res += mod[id];
        return res;
    }
};


// verified
//   http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_14_B&lang=jp
void AOJ_ALDS1_14_B() {
    string T, P;
    cin >> T >> P;
    RollingHash rh1(T), rh2(P);
    for (int i = 0; i + P.size() <= T.size(); i++) {
        if (rh1.get(i, i + P.size()) == rh2.get(0, P.size())) {
            cout << i << "\n";
        }
    }
}

int main() {
    AOJ_ALDS1_14_B();
    return 0;
}

### Prompt

Please create a solution in CPP to the following problem:

Find places where a string P is found within a text T. Print all indices of T where P found. The indices of T start with 0.

Constraints

* 1 ≤ length of T ≤ 1000000
* 1 ≤ length of P ≤ 10000
* The input consists of alphabetical characters and digits

Input

In the first line, a text T is given. In the second line, a string P is given.

Output

Print an index of T where P found in a line. Print the indices in ascending order.

Examples

Input

aabaaa
aa


Output

0
3
4


Input

xyzz
yz


Output

1


Input

abc
xyz


Output

### Response

```cpp
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

class RollingHash {
    const ll base = 9973;
    const vector <ll> mod = {999999937LL, 1000000007LL};
    string S;
    vector <ll> hash[2], pow[2];

public:
    RollingHash(const string &s) {
        S = s;
        int n = S.size();
        for (int i = 0; i < 2; i++) {
            hash[i].assign(n + 1, 0);
            pow[i].assign(n + 1, 1);
            for (int j = 0; j < n; j++) {
                hash[i][j + 1] = (hash[i][j] * base + S[j]) % mod[i];
                pow[i][j + 1] = pow[i][j] * base % mod[i];
            }
        }
    }

    // get hash of [l:r)
    ll get(int l, int r, int id = 0) {
        ll res = hash[id][r] - hash[id][l] * pow[id][r - l] % mod[id];
        if (res < 0) res += mod[id];
        return res;
    }
};


// verified
//   http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_14_B&lang=jp
void AOJ_ALDS1_14_B() {
    string T, P;
    cin >> T >> P;
    RollingHash rh1(T), rh2(P);
    for (int i = 0; i + P.size() <= T.size(); i++) {
        if (rh1.get(i, i + P.size()) == rh2.get(0, P.size())) {
            cout << i << "\n";
        }
    }
}

int main() {
    AOJ_ALDS1_14_B();
    return 0;
}

```