// 参考了用户 tk4114 的代码
#include <bits/stdc++.h>
using namespace std;

int main(void) {
	ios::sync_with_stdio(false);
	cin.tie(0);

	char T[1000005], P[10005];
	cin.getline(T, 1000005);
	int Tl = cin.gcount() - 1;
	cin.getline(P, 10005);
	int Pl = cin.gcount() - 1;
	if (Pl > Tl) return 0;

	int jmp[10005];
	jmp[1] = 0;
	int i = 2, j = 0;
	while (i <= Pl) {
		if (P[i - 1] == P[j]) {
			i++;
			j++;
			jmp[i - 1] = j;
		} else if (j > 0) {
			j = jmp[j];
		} else {
			jmp[i] = 0;
			i++;
		}
	}

	i = 0;
	j = 0;
	while (i < Tl) {
		if (T[i] == P[j]) {
			i++;
			j++;
			if (j == Pl) {
				cout << i - Pl << endl;
				j = jmp[j];
			}
		} else if (j > 0) {
			j = jmp[j];
		} else {
			i++;
		}
	}
}

### Prompt

Develop a solution in Cpp to the problem described below:

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
// 参考了用户 tk4114 的代码
#include <bits/stdc++.h>
using namespace std;

int main(void) {
	ios::sync_with_stdio(false);
	cin.tie(0);

	char T[1000005], P[10005];
	cin.getline(T, 1000005);
	int Tl = cin.gcount() - 1;
	cin.getline(P, 10005);
	int Pl = cin.gcount() - 1;
	if (Pl > Tl) return 0;

	int jmp[10005];
	jmp[1] = 0;
	int i = 2, j = 0;
	while (i <= Pl) {
		if (P[i - 1] == P[j]) {
			i++;
			j++;
			jmp[i - 1] = j;
		} else if (j > 0) {
			j = jmp[j];
		} else {
			jmp[i] = 0;
			i++;
		}
	}

	i = 0;
	j = 0;
	while (i < Tl) {
		if (T[i] == P[j]) {
			i++;
			j++;
			if (j == Pl) {
				cout << i - Pl << endl;
				j = jmp[j];
			}
		} else if (j > 0) {
			j = jmp[j];
		} else {
			i++;
		}
	}
}

```