Please enter your email address or userHandle.
Given strings s1 and s2, you need to find if s2 is a rotated version of the string s1. The strings are lowercase.
The first line of the input contains a single integer T, denoting the number of test cases. Then T test case follows. Each testcase contains two lines for s1 and s2.
For each testcase, in a new line, you need to print 1 if s2 is a rotated version of s1; else print 0.
1 <= T <= 103
1 <= |s1|, |s2| <= 107
Testcase 1: s1 is geeksforgeeks, s2 is forgeeksgeeks. Clearly, s2 is a rotated version of s1 as s2 can be obtained by left-rotating s1 by 5 units.
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.