#include <iostream>
#include <cstring>
using namespace std;
typedef unsigned long long ull;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    char t[1000001], p[10001];
    cin>>t>>p;
    int tl=strlen(t);
    int pl=strlen(p);
    if(pl>tl) return 0;
    const ull base = 1000000007ULL;
    ull bt = 1;
    for(int i=0; i<pl; i++) bt*=base;
    ull th=0, ph=0;
    for(int i=0; i<pl; i++){
        ph*=base;
        ph+=p[i];
        th*=base;
        th+=t[i];
    }
    for(int pos=0; pos<=tl-pl; pos++) {
        if(th==ph) {
            if(memcmp(t+pos, p, pl)==0) cout<<pos<<'\n';
        }
        th*=base;
        th-=bt*t[pos];
        th+=t[pos+pl];
    }
    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 <cstring>
using namespace std;
typedef unsigned long long ull;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    char t[1000001], p[10001];
    cin>>t>>p;
    int tl=strlen(t);
    int pl=strlen(p);
    if(pl>tl) return 0;
    const ull base = 1000000007ULL;
    ull bt = 1;
    for(int i=0; i<pl; i++) bt*=base;
    ull th=0, ph=0;
    for(int i=0; i<pl; i++){
        ph*=base;
        ph+=p[i];
        th*=base;
        th+=t[i];
    }
    for(int pos=0; pos<=tl-pl; pos++) {
        if(th==ph) {
            if(memcmp(t+pos, p, pl)==0) cout<<pos<<'\n';
        }
        th*=base;
        th-=bt*t[pos];
        th+=t[pos+pl];
    }
    return 0;
}
```