BETA

Difficulty Level:

Basic

Total Submissions: 4337 Accuracy:

43.46%

Implement strstr (Function Problem)

Your task  is to implement the function strstr. The function takes two strings as arguments(s,x) and  locates the occurrence of the string x in the string s. The function returns and integer denoting  the first occurrence of the string x .
 
Input:
The first line of input contains an integer T denoting the no of test cases . Then T test cases follow. The first line of each test case contains two strings str and target.

Output:
For each test case in a new line output will be an integer denoting the first occurrence of the target  string in the string s. Return -1 if no match found.
 
Constraints:
1<=T<=100
1<=length of (s,x)<=1000

Example:
Input

2
GeeksForGeeks Fr
GeeksForGeeks For
Output
-1
5



Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.

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

Contributor: Amit Khandelwal, Harshit Sidhwa


					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

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