# PROBLEM LINK:

Practice

Contest: Division 1

Contest: Division 2

Contest: Division 3

Contest: Division 4

* Author:* Vishesh Saraswat

*Nishank Suresh, Satyam*

**Testers:***Nishank Suresh*

**Editorialist:**# DIFFICULTY:

816

# PREREQUISITES:

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')
```