#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

// kmp ??????????????????????¨????
vector<int> makeTable(const string& s) {
    int n = s.size();
    vector<int> ret(n+1);
    ret[0] = -1;
    int j = -1;
    for (int i = 0; i < n; i++) {
        while (j >= 0 && s[i] != s[j]) j = ret[j];
        ret[i+1] = ++j;
    }
    return ret;
}

// str ????????? word ??¨?????????????????´????????????????????????
// ret ??????????????????????´? el ???, ???str[el] ????????????????????? word ??¨?????´??????????????¨?????????
vector<int> kmp(const string& str, const string& word) {
    vector<int> table = makeTable(word), ret;
    int m = 0, i = 0, n = str.size();
    while (m+i < n) {
        if (word[i] == str[m+i]) {
            if (++i == (int)(word.size())) {
                ret.push_back(m);
                m = m+i-table[i];
                i = table[i];
            }
        } else {
            m = m+i-table[i];
            if (i > 0) i = table[i];
        }
    }
    return ret;
}


int main() {
        string text, pattern;
        cin >> text >> pattern;
        vector<int> list = kmp(text, pattern);
        vector<int>::iterator it = list.begin();
        while (it != list.end()) {
                cout << *it << endl;
                it++;
        }
        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 <string>
#include <algorithm>
#include <vector>

using namespace std;

// kmp ??????????????????????¨????
vector<int> makeTable(const string& s) {
    int n = s.size();
    vector<int> ret(n+1);
    ret[0] = -1;
    int j = -1;
    for (int i = 0; i < n; i++) {
        while (j >= 0 && s[i] != s[j]) j = ret[j];
        ret[i+1] = ++j;
    }
    return ret;
}

// str ????????? word ??¨?????????????????´????????????????????????
// ret ??????????????????????´? el ???, ???str[el] ????????????????????? word ??¨?????´??????????????¨?????????
vector<int> kmp(const string& str, const string& word) {
    vector<int> table = makeTable(word), ret;
    int m = 0, i = 0, n = str.size();
    while (m+i < n) {
        if (word[i] == str[m+i]) {
            if (++i == (int)(word.size())) {
                ret.push_back(m);
                m = m+i-table[i];
                i = table[i];
            }
        } else {
            m = m+i-table[i];
            if (i > 0) i = table[i];
        }
    }
    return ret;
}


int main() {
        string text, pattern;
        cin >> text >> pattern;
        vector<int> list = kmp(text, pattern);
        vector<int>::iterator it = list.begin();
        while (it != list.end()) {
                cout << *it << endl;
                it++;
        }
        return 0;
}
```