# BROKENSTRING - Editorial

Author: Vishesh Saraswat
Testers: Nishank Suresh, Satyam
Editorialist: Nishank Suresh

816

None

# PROBLEM:

Given a string S, does joining its first half and second half in any order result in the same final string?

# EXPLANATION:

Let A be the first half and B be the second half.
Then, there are only two possible orders: AB or BA.

So, simply construct these two strings and check if they’re equal.

An alternate solution is to note that AB = BA if and only if A = B, so you can just check that instead.

# TIME COMPLEXITY

\mathcal{O}(N) per test case.

# CODE:

Editorialist's code (Python)
for _ in range(int(input())):
s = input()
n = len(s)
print('Yes' if s[:n//2] == s[n//2:] else 'No')