Find Substring from last of the Given String
Submissions: 2960   Accuracy:

22.48%

  Difficulty: Basic   Marks: 1

Given a string and a sub-string, your task is to find the last index of that sub-string that appears in the given String.
If the given sub-string doesn't appear in the string then print "-1".

Input:
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contain a sub-string S and a string S1.

Output: 
For each test case in a new line print the required result.

Constraints:
1<=T<=100
1<=S, S1<=10000

Example:

Input:
2
geek
geeksforgeeks
abc
ababc

Output:
9
3

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

Contributor: Saksham Raj Seth
Author: saksham seth


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 ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.