Sufix Tree - Application 1 - Pattern Find

hard
Given a string S and a pattern P, print all occurrences of P in S. Use Suffix Tree only.

Input Format

Input consists of 2 lines First contains string S, second contains pattern P

Output Format

Print all the occurances of pattern in string

Constraints

|S| <= 10^5

Example

Input
abcbcc
bc
Output
1
3
Previous
Dfs In Suffix Tree
Next
Suffix Tree - Application 2 - Longest Repeated Substrings

Related Questions