D - Pentagon Editorial by evima
Another Solution?An edge is short if it is contained in ABCDEAEDCBA
as a substring, and long otherwise.
Sample Implementation (Python)
P = "ABCDEAEDCBA"
S = input()
T = input()
print("Yes" if (S in P) == (T in P) else "No")
posted:
last update: