#include <iostream>
#include <string>
using namespace std;

#define STRMAXT 1000000
#define STRMAXP 10000

void KMP(const string T, const string P){
	int tcur = 0;
	int pcur = 2;
	int tablecur = 0;
	int plen = P.length();
	int tlen = T.length();
	int* Table = new int[plen + 1];
	Table[0] = -1;
	if (plen >= 2){
		Table[1] = 0;
		while (pcur <= plen){
			if (P[pcur - 1] == P[tablecur]){
				Table[pcur] = tablecur + 1;
				pcur = pcur + 1;
				tablecur = tablecur + 1;
			}
			else if (tablecur > 0){
				tablecur = Table[tablecur];
			}
			else{
				Table[pcur] = 0;
				pcur = pcur + 1;
			}
		}
	}
	pcur = 0;
	while (tcur + pcur < tlen){
		if (P[pcur] == T[tcur + pcur]){
			pcur++;
			if (pcur == plen){
				cout << tcur << endl;
				tcur = tcur + pcur - Table[pcur];
				if (pcur > 0){
					pcur = Table[pcur];
				}
			}
		}
		else{
			tcur = tcur + pcur - Table[pcur];
			if (pcur > 0){
				pcur = Table[pcur];
			}
		}
	}
	delete[] Table;
}

int main(){
	string T;
	string P;
	std::cin >> T >> P;
	KMP(T, P);

	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 <string>
using namespace std;

#define STRMAXT 1000000
#define STRMAXP 10000

void KMP(const string T, const string P){
	int tcur = 0;
	int pcur = 2;
	int tablecur = 0;
	int plen = P.length();
	int tlen = T.length();
	int* Table = new int[plen + 1];
	Table[0] = -1;
	if (plen >= 2){
		Table[1] = 0;
		while (pcur <= plen){
			if (P[pcur - 1] == P[tablecur]){
				Table[pcur] = tablecur + 1;
				pcur = pcur + 1;
				tablecur = tablecur + 1;
			}
			else if (tablecur > 0){
				tablecur = Table[tablecur];
			}
			else{
				Table[pcur] = 0;
				pcur = pcur + 1;
			}
		}
	}
	pcur = 0;
	while (tcur + pcur < tlen){
		if (P[pcur] == T[tcur + pcur]){
			pcur++;
			if (pcur == plen){
				cout << tcur << endl;
				tcur = tcur + pcur - Table[pcur];
				if (pcur > 0){
					pcur = Table[pcur];
				}
			}
		}
		else{
			tcur = tcur + pcur - Table[pcur];
			if (pcur > 0){
				pcur = Table[pcur];
			}
		}
	}
	delete[] Table;
}

int main(){
	string T;
	string P;
	std::cin >> T >> P;
	KMP(T, P);

	return 0;
}

```