AtCoder Beginner Contest 145 - Echo

Given are a positive integer N and a string S of length N consisting of lowercase English letters.
Determine whether the string is a concatenation of two copies of some string.
That is, determine whether there is a string T such that S = T + T.

-----Constraints-----
 - 1 \leq N \leq 100
 - S consists of lowercase English letters.
 - |S| = N

-----Input-----
Input is given from Standard Input in the following format:
N
S

-----Output-----
If S is a concatenation of two copies of some string, print Yes; otherwise, print No.

-----Sample Input-----
6
abcabc

-----Sample Output-----
Yes

Let T =  abc, and S = T + T.

Difficulty: EASY

Starter code:

Solutions:
n = int(input())
s = input()
print('YNeos'[n % 2 != 0 or s[0:n // 2] != s[n // 2:n]::2])


n = int(input())
s = input()
if n % 2 == 0:
	if s[:n // 2] == s[n // 2:]:
		print('Yes')
		return
print('No')


n = int(input())
s = input()
if n % 2 == 0 and s[:n // 2] == s[n // 2:]:
	print('Yes')
else:
	print('No')


a = int(input())
b = input()
c = b[:a // 2]
d = b[a // 2:a]
print('Yes' if c == d else 'No')


N = int(input())
S = input()
ans = 'No'
if N % 2 == 0:
	if S[:N // 2] == S[N // 2:]:
		ans = 'Yes'
print(ans)


N = int(input())
S = input()
if len(S) % 2 == 0:
	for i in range(len(S) // 2):
		if S[i] != S[i + len(S) // 2]:
			print('No')
			return
	print('Yes')
	return
print('No')


n = int(input())
s = list(input())
print('Yes' if s[:n // 2] == s[n // 2:] else 'No')


N = int(input())
S = input()
if S == S[0:N // 2] + S[0:N // 2]:
	print('Yes')
else:
	print('No')


n = int(input())
s = input()
x = s[:n // 2]
s = s[n // 2:]
if x == s:
	print('Yes')
else:
	print('No')


n = int(input())
s = input()
if n % 2 == 1:
	print('No')
else:
	head = s[:n // 2]
	tail = s[n // 2:]
	if head == tail:
		print('Yes')
	else:
		print('No')


n = int(input())
s = input()
if s == s[:len(s) // 2] * 2:
	print('Yes')
else:
	print('No')


n = int(input())
x = input()
if x[0:n // 2] == x[n // 2:]:
	print('Yes')
else:
	print('No')


l = int(input())
s = input()
if s == s[:l // 2] + s[:l // 2]:
	print('Yes')
else:
	print('No')


N = int(input())
S = input()
print('Yes' if S[:len(S) // 2] == S[len(S) // 2:] else 'No')


n = int(input())
s = list(input())
if n % 2 == 0:
	bef = s[:n // 2]
	aft = s[n // 2:]
	if bef == aft:
		print('Yes')
	else:
		print('No')
else:
	print('No')


n = int(input())
s = input()
print('YNeos'[s[:n // 2] * 2 != s::2])


n = int(input())
s = input()
res = 'Yes' if s[0:n // 2] == s[n // 2:] else 'No'
print(res)


a = int(input())
s = input()
S = 'Yes' * (s[0:a // 2] == s[a // 2:]) or 'No'
print(S)


n = int(input())
s = input()
if n % 2 != 0:
	print('No')
elif s[:n // 2] == s[n // 2:]:
	print('Yes')
else:
	print('No')


n = int(input())
s = list(input())
m = n // 2
if n % 2 != 0:
	ans = 'No'
else:
	for i in range(m):
		if s[i] != s[m + i]:
			ans = 'No'
			break
		ans = 'Yes'
print(ans)


n = int(input())
s = input()
if n % 2 == 1:
	res = 'No'
elif s[:n // 2] == s[n // 2:]:
	res = 'Yes'
else:
	res = 'No'
print(res)


N = int(input())
S = input()
if N % 2 == 1:
	print('No')
	return
m = N // 2
for i in range(m):
	if S[i] != S[i + m]:
		print('No')
		return
print('Yes')


s = int(input())
t = input()
if t[:s // 2] == t[s // 2:]:
	print('Yes')
else:
	print('No')


n = int(input())
s = input()
print(['No', 'Yes'][s[:n // 2] == s[n // 2:]])


n = int(input())
s = input()
p = n // 2
if s[:p] == s[p:]:
	print('Yes')
else:
	print('No')


n = int(input())
s = input()
a = s[:n // 2]
if s == a + a:
	print('Yes')
else:
	print('No')


N = int(input())
S = input()
n = N // 2
print('YNeos'[S != S[:n] * 2::2])


(_, S) = (input(), input())
l = len(S)
print('Yes' if S[:l // 2] == S[l // 2:] else 'No')


n = int(input())
s = input()
print('Yes' if s[:n >> 1] == s[n >> 1:] else 'No')


S = int(input())
T = input()
S = int(S)
print('Yes' if T[:S // 2] == T[S // 2:] else 'No')


n = int(input())
s = input()
half = n // 2
a = s[:half]
b = s[half:]
if a == b:
	print('Yes')
else:
	print('No')


n = int(input())
s = input()
v = 'No'
if s[:n // 2] == s[n // 2:]:
	v = 'Yes'
print(v)


N = int(input())
S = input()
ret = 'No'
for i in range(N // 2):
	s = S[:i + 1]
	if s + s == S:
		ret = 'Yes'
		break
print(ret)


a = int(input())
b = input()
if b[0:a // 2] == b[a // 2:]:
	print('Yes')
else:
	print('No')


n = int(input())
s = input()
s1 = n // 2
ans = 'No'
if n & 1 != 1:
	if s[:s1] == s[s1:]:
		ans = 'Yes'
print(ans)


N = int(input())
S = input()
if N % 2 != 0:
	print('No')
else:
	n = int(N / 2)
	s1 = S[:n]
	s2 = S[n:]
	if s1 == s2:
		print('Yes')
	else:
		print('No')


N = int(input())
S = input()
i = N // 2
print('Yes' if S[:i] == S[i:] else 'No')


input()
s = input()
print('Yes' if s[len(s) // 2:] == s[:len(s) // 2] else 'No')


N = int(input())
S = input()
if N % 2 == 1:
	print('No')
	return
if S[:N // 2] == S[N // 2:]:
	print('Yes')
else:
	print('No')


n = int(input())
if n % 2 == 0:
	work = int(n / 2)
	s = input()
	a = s[:work]
	b = s[work:]
	if a == b:
		print('Yes')
	else:
		print('No')
else:
	print('No')


N = int(input())
S = input()
if N % 2 != 0:
	print('No')
	return
x = int(len(S) / 2)
y = S[0:x]
z = S[x:len(S)]
if y == z:
	print('Yes')
else:
	print('No')


N = int(input())
S = input()
if N % 2 == 1:
	print('No')
else:
	ans = 'Yes' if S[:N // 2] == S[N // 2:] else 'No'
	print(ans)


n = int(input())
list_s = list(input())
if n % 2 != 0:
	print('No')
elif ''.join(list_s[:n // 2]) == ''.join(list_s[n // 2:]):
	print('Yes')
else:
	print('No')


n = int(input())
lst = list(input())
count = 0
if n % 2 == 0:
	for i in range(n // 2):
		if lst[i] == lst[i + n // 2]:
			count += 1
if count == n / 2:
	print('Yes')
else:
	print('No')


(N, S) = (int(input()), input())
print('NYoe s'[S[N // 2:] == S[:N // 2]::2])


def answer(n: int, s: str) -> str:
	if n % 2 == 1:
		return 'No'
	middle = n // 2
	if s[:middle] == s[middle:]:
		return 'Yes'
	return 'No'

def main():
	n = int(input())
	s = input()
	print(answer(n, s))

def __starting_point():
	main()
__starting_point()


N = int(input())
S = input()
half = N // 2
print('Yes' if S[:half] == S[half:] else 'No')


n = int(input())
s = str(input())
d = True
if len(s) % 2 == 0:
	for i in range(len(s) // 2):
		if s[i] != s[len(s) // 2 + i]:
			d = False
else:
	d = False
if d:
	print('Yes')
else:
	print('No')


n = int(input())
s = input()
cnt = 0
if n % 2 == 1:
	print('No')
else:
	for i in range(n // 2):
		if s[i] == s[i + n // 2]:
			cnt += 1
	if cnt == n // 2:
		print('Yes')
	else:
		print('No')


n = int(input())
S = input()
if S[:n // 2] == S[n // 2:]:
	print('Yes')
else:
	print('No')


N = int(input())
S = input()
t1 = S[:N // 2]
t2 = S[N // 2:]
print('Yes' if t1 == t2 else 'No')


n = int(input())
s = input()
if n % 2 == 0:
	if s == s[:n // 2] * 2:
		print('Yes')
		exit()
print('No')


n = int(input())
s = input()
h = n // 2
print('Yes' if s[:h] == s[h:] else 'No')


from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(500000)
INF = float('inf')
(YES, Yes, yes, NO, No, no) = ('YES', 'Yes', 'yes', 'NO', 'No', 'no')
(dy4, dx4) = ([0, 1, 0, -1], [1, 0, -1, 0])
(dy8, dx8) = ([0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1])

def inside(y, x, H, W):
	return 0 <= y < H and 0 <= x < W

def ceil(a, b):
	return (a + b - 1) // b

def sum_of_arithmetic_progression(s, d, n):
	return n * (2 * s + (n - 1) * d) // 2

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	g = gcd(a, b)
	return a / g * b

def solve():
	N = int(input())
	S = input()
	if N % 2 == 0:
		h = N // 2
		if S[:h] == S[h:]:
			print('Yes')
			return
	print('No')

def main():
	solve()

def __starting_point():
	main()
__starting_point()


N = int(input())
S = input()
X = S[:N // 2]
if X + X == S:
	print('Yes')
else:
	print('No')


n = int(input())
s = input()
if n % 2 == 1:
	print('No')
	return
if s[:n // 2] == s[n // 2:]:
	print('Yes')
else:
	print('No')


N = int(input())
S = input()
if N % 2 == 1:
	print('No')
	return
if N % 2 == 0:
	T_1 = S[:N // 2]
	T_2 = S[N // 2:]
	if T_1 == T_2:
		print('Yes')
	else:
		print('No')


n = int(input())
m = input()
if m[:n // 2] == m[n // 2:]:
	print('Yes')
else:
	print('No')


n = int(input())
s = str(input())
if len(s) % 2 == 1:
	print('No')
else:
	t = len(s) // 2
	if s[t:] == s[:t]:
		print('Yes')
	else:
		print('No')


input()
l = input()
print('NYoe s'[l[0:int(len(l) / 2)] == l[int(len(l) / 2):len(l)]::2])


import sys
n = int(input())
s = input()
if n % 2:
	print('No')
	return
half = n // 2
for i in range(half):
	if s[i] != s[i + half]:
		print('No')
		return
print('Yes')


n = int(input())
s = input()
if n % 2 == 1:
	print('No')
	return
n2 = n // 2
for i in range(n2):
	if s[i] != s[i + n2]:
		print('No')
		return
print('Yes')


n = int(input())
n1 = n // 2
s = input()
s1 = s[n1:]
s2 = s[:n1]
if n % 2 != 0:
	print('No')
elif s1 == s2:
	print('Yes')
else:
	print('No')


N = int(input())
S = input()
print(['No', 'Yes'][int(S[:N // 2] == S[N // 2:])])


n = int(input())
l = input()
print('Yes' if l[0:n // 2] == l[n // 2:] else 'No')


n = int(input())
s = input()
print('No' if n % 2 != 0 or s[:n // 2] != s[n // 2:] else 'Yes')


b = int(input())
a = input()
c = []
for i in range(b):
	c.append(a[i])
if b == 1:
	print('No')
elif c[:int(b / 2)] == c[int(b / 2):]:
	print('Yes')
else:
	print('No')


N = int(input())
S = input()
if N % 2 == 1:
	print('No')
elif S[0:N // 2] == S[N // 2:N]:
	print('Yes')
else:
	print('No')


N = int(input())
S = input()
x = 'Yes'
if N % 2 == 1:
	print('No')
else:
	for i in range(0, N // 2):
		if S[i] != S[i + N // 2]:
			x = 'No'
			break
	print(x)


(n, r) = (int(input()), input())
print('Yes' if r[:n // 2] == r[n // 2:] else 'No')


N = int(input())
S = input()
result = 'No'
if N % 2 == 0:
	s1 = S[0:N // 2 - 1]
	s2 = S[N // 2:N - 1]
	if N == 2:
		s1 = S[0:1]
		s2 = S[1:2]
	result = 'Yes' if s1 == s2 else 'No'
print(result)


import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):

	def assertIO(self, input, output):
		(stdout, stdin) = (sys.stdout, sys.stdin)
		(sys.stdout, sys.stdin) = (StringIO(), StringIO(input))
		resolve()
		sys.stdout.seek(0)
		out = sys.stdout.read()[:-1]
		(sys.stdout, sys.stdin) = (stdout, stdin)
		self.assertEqual(out, output)

	def test_入力例_1(self):
		input = '6\nabcabc'
		output = 'Yes'
		self.assertIO(input, output)

	def test_入力例_2(self):
		input = '6\nabcadc'
		output = 'No'
		self.assertIO(input, output)

	def test_入力例_3(self):
		input = '1\nz'
		output = 'No'
		self.assertIO(input, output)

def resolve():
	N = int(input())
	S = input()
	ans = 'No'
	if N % 2 == 0 and S[:N // 2] == S[N // 2:]:
		ans = 'Yes'
	print(ans)

def __starting_point():
	resolve()
__starting_point()


n = int(input())
s = input()
t = s[:n // 2]
ans = 'Yes' if s == t + t else 'No'
print(ans)


N = int(input())
S = input()
a = int(N / 2)
print('Yes' if N % 2 == 0 and S[:a] == S[a:] else 'No')


n = int(input())
s = input()
m = n // 2
t = s[:m]
print('Yes' if s == t + t else 'No')


N = int(input())
S = input()

def s():
	name = 'No'
	if S[0:int(N / 2)] == S[int(N / 2):]:
		name = 'Yes'
	return name
print(s())


import sys
n = int(input())
s = list(input())
if n % 2 != 0:
	print('No')
	return
a = s[:n // 2]
b = s[n // 2:]
cnt = 0
for i in range(n // 2):
	if a[i] != b[i]:
		cnt += 1
if cnt == 0:
	print('Yes')
else:
	print('No')


def resolve():
	n = int(input())
	s = input()
	if s == s[:n // 2] + s[:n // 2]:
		print('Yes')
	else:
		print('No')
resolve()


N = int(input())
S = list(input())
print('Yes' if S[:N // 2] == S[N // 2:] else 'No')


n = int(input())
s = input()
len_t = n // 2
t = s[0:len_t] * 2
if t == s:
	print('Yes')
else:
	print('No')


N = int(input())
S = str(input())
tmp = str()
for i in range(N // 2):
	tmp += S[i]
if tmp * 2 == S:
	print('Yes')
else:
	print('No')


import sys
N = int(input())
S = input()
if N % 2 != 0:
	print('No')
	return
else:
	idx = int(N / 2)
	if S[:idx] == S[idx:]:
		print('Yes')
	else:
		print('No')


N = int(input())
S = input()
print(['No', 'Yes'][N % 2 == 0 and S[:N // 2] == S[N // 2:]])


m = int(input()) // 2
s = input()
print('Yes' if s[:m] == s[m:] else 'No')


N = int(input())
S = input()
a = N // 2
if S[:a] == S[a:]:
	print('Yes')
else:
	print('No')


a = int(input()) // 2
s = input()
print('YNeos'[s != s[:a] + s[:a]::2])


n = int(input())
s = input()
x = n // 2
print(['Yes', 'No'][n % 2 != 0 or s[:x] != s[x:]])


N = int(input())
S = input()
A = N // 2
if S[A:] == S[:A]:
	print('Yes')
else:
	print('No')


n = int(input())
s = input()
m = n // 2
print('Yes' if s == s[0:m] + s[0:m] else 'No')


input()
s = input()
half = int(len(s) / 2)
print('Yes' if s[:half] == s[half:] else 'No')


n = int(input())
s = str(input())
if s[:n // 2] == s[n // 2:]:
	print('Yes')
else:
	print('No')


N = int(input())
a = input()
b = int(N // 2)
if N % 2 != 0 or a[0:b] != a[b:N]:
	print('No')
else:
	print('Yes')


N = int(input())
S = input()
front = S[:N // 2]
latter = S[N // 2:]
if front == latter:
	print('Yes')
else:
	print('No')


(n, a) = open(0)
n = int(n)
print('YNeos'[a[:n // 2] != a[n // 2:-1]::2])


n = int(input())
L = input()
if L[0:n // 2] == L[n // 2:n]:
	print('Yes')
else:
	print('No')


n = int(input())
s = list(input())
a = 1
if len(s) % 2 == 1:
	a = 0
for b in range(int(len(s) / 2)):
	if a == 1 and s[b] != s[int(len(s) / 2 + b)]:
		a = 0
if a == 1:
	print('Yes')
else:
	print('No')


n = int(input())
t = list(input())
if t[:n // 2] == t[n // 2:]:
	print('Yes')
else:
	print('No')


N = int(input())
S = input()
s = S[0:N // 2]
t = S[N // 2:N]
print('Yes' if s == t else 'No')


N = int(input())
s = input()
if s == s[:N // 2] * 2:
	print('Yes')
else:
	print('No')


(N, S) = (int(input()), input())
print('NYoe s'[N % 2 == 0 and S[:N // 2] == S[N // 2:]::2])


(n, s) = open(0)
print('YNeos'[s[:-1] != s[:int(n) // 2] * 2::2])


n = int(input())
S = input()
if n % 2 == 1:
	print('No')
elif S[:n // 2] == S[n // 2:]:
	print('Yes')
else:
	print('No')


import sys
sys.setrecursionlimit(10 ** 8)
ini = lambda : int(sys.stdin.readline())
inl = lambda : [int(x) for x in sys.stdin.readline().split()]
ins = lambda : sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print('\x1b[33m', *a, '\x1b[0m', **dict(file=sys.stderr, **kw))

def solve():
	n = ini()
	s = ins()
	if n % 2 == 1:
		return False
	t = s[:n // 2]
	return s == t + t
print('Yes' if solve() else 'No')


n = int(input())
st = input()
if st[:n // 2] == st[n // 2:]:
	print('Yes')
else:
	print('No')


def main():
	N = int(input()) // 2
	S = input()
	if S[:N] == S[N:]:
		print('Yes')
	else:
		print('No')

def __starting_point():
	main()
__starting_point()


_ = input()
s = input()
m = len(s) // 2
print('Yes') if s[:m] == s[m:] else print('No')


n = int(input())
s = input()
print('YNeos'[not (s[0:n // 2] == s[n // 2:n] and n % 2 == 0)::2])


n = int(input())
s = input()
i = n // 2
print('Yes' if s[:i] == s[i:] else 'No')


N = int(input())
s = input()
print('Yes' if N % 2 == 0 and s[:N // 2] == s[N // 2:] else 'No')


N = int(input())
S = input()
result = 'No'
if len(S) % 2 == 0:
	if S[:len(S) // 2] == S[len(S) // 2:]:
		result = 'Yes'
print(result)


import sys
n = int(input())
s = list(input())
if n % 2 == 1:
	print('No')
	return
else:
	for i in range(n // 2):
		if s[i] == s[n // 2 + i]:
			continue
		print('No')
		return
	print('Yes')


N = int(input())
A = str(input())
if N % 2 == 0:
	if A[:N // 2] == A[N // 2:]:
		print('Yes')
	else:
		print('No')
else:
	print('No')


N = int(input())
S = str(input())
flag = False
half = (N + 1) // 2
if S[:half] == S[half:N]:
	flag = True
if flag:
	print('Yes')
else:
	print('No')


import sys
N = int(input())
S = input()
if N % 2 == 1:
	print('No')
	return
if S[:N // 2] == S[N // 2:]:
	print('Yes')
	return
print('No')


import sys

def resolve(in_):
	N = int(next(in_))
	S = next(in_).strip()
	if N % 2:
		return 'No'
	n2 = N // 2
	return 'Yes' if S[:n2] == S[n2:] else 'No'

def main():
	answer = resolve(sys.stdin)
	print(answer)

def __starting_point():
	main()
__starting_point()