Created
October 14, 2023 11:05
-
-
Save modos/17e107bdb740ba7f4597e813b5358eaa to your computer and use it in GitHub Desktop.
دوقلوهای افسانهای و خرید گردنبند
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def can_strings_be_equal(s1, s2): | |
if len(s1) != len(s2): | |
return False | |
concatenated = s1 + s1 | |
if s2 in concatenated: | |
return True | |
elif s2[::-1] in concatenated: | |
return True | |
else: | |
return False | |
n = int(input()) | |
answers = list() | |
for i in range(n): | |
line = input().split() | |
a = line[0] | |
b = line[1] | |
ans = "" | |
if (can_strings_be_equal(a, b) == True): | |
ans = "YES" | |
else: | |
ans = "NO" | |
answers.append(ans) | |
for i in range(len(answers)): | |
print(answers[i]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment