Search Pattern
Submissions: 2055   Accuracy:


  Difficulty: Medium   Marks: 4

Given two strings, one is a text string and other is a pattern string. The task is to print the indexes of all the occurences of pattern string in the text string. For printing, Starting Index of a string should be taken as 1.

Note: Strings contain only lower case alphabets.

First line of the input contains an integer 'T' denoting the total number of test cases. Then T test cases follow. Each test consists of two lines. First line of each test case contains the text string. Second line of each test case contains the pattern string.

Print indexes all the occurences of the pattern strings in the text string in a single line seprated by spaces.
Print -1 if no pattern found.

1 <= T <= 100
1 <= Sizeof of text String <= 10000
1 <= Sizeof pattern String <= Sizeof text String

Input :


Output :
1 18

** For More Input/Output Examples Use 'Expected Output' option **

Author: jain_rishabh

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Need help with your code? Please use, generate link and share the link here.

to report an issue on this page.