Skip to content

Instantly share code, notes, and snippets.

@modos
Created October 14, 2023 11:05
Show Gist options
  • Save modos/17e107bdb740ba7f4597e813b5358eaa to your computer and use it in GitHub Desktop.
Save modos/17e107bdb740ba7f4597e813b5358eaa to your computer and use it in GitHub Desktop.
دوقلوهای افسانه‌ای و خرید گردنبند
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