#include <iostream>
#include <iomanip>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>

using namespace std;

int table[10001];

int main(void)
{
    string T, P;
    cin >> T >> P;
    int i = 0, j = 1;
    while (j < P.length())
    {
        bool match = P[i] == P[j];
        if (!match && i > 0)
        {
            i = table[i];
        }
        else
        {
            if (match) i++;
            j++;
            table[j] = i;
        }
    }
    j = 0;
    for (i = 0; i < T.length(); i++)
    {
        // cout << "i" << i << "j" << j << "\n";
        bool match = T[i] == P[j];
        if (match)
        {
            j++;
            if (j == P.length())
            {
                cout << i - P.length() + 1 << "\n";
                j = table[j];
            }
        }
        else
        {
            if (j != 0) i--;
            j = table[j];
        }
    }
    return 0;
}

### Prompt

Generate a CPP solution 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 <iomanip>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>

using namespace std;

int table[10001];

int main(void)
{
    string T, P;
    cin >> T >> P;
    int i = 0, j = 1;
    while (j < P.length())
    {
        bool match = P[i] == P[j];
        if (!match && i > 0)
        {
            i = table[i];
        }
        else
        {
            if (match) i++;
            j++;
            table[j] = i;
        }
    }
    j = 0;
    for (i = 0; i < T.length(); i++)
    {
        // cout << "i" << i << "j" << j << "\n";
        bool match = T[i] == P[j];
        if (match)
        {
            j++;
            if (j == P.length())
            {
                cout << i - P.length() + 1 << "\n";
                j = table[j];
            }
        }
        else
        {
            if (j != 0) i--;
            j = table[j];
        }
    }
    return 0;
}

```