While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s.

 [Image] 

He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in his own bag, each was a palindrome string and all those strings had the same length.

He asked you to help him and tell him if he has worn his own back-bag. Check if the given string s is a concatenation of k palindromes of the same length.


-----Input-----

The first line of input contains string s containing lowercase English letters (1 ≤ |s| ≤ 1000).

The second line contains integer k (1 ≤ k ≤ 1000).


-----Output-----

Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.


-----Examples-----
Input
saba
2

Output
NO

Input
saddastavvat
2

Output
YES



-----Note-----

Palindrome is a string reading the same forward and backward.

In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".

Difficulty: EASY
Tags: String algorithms

Implementation

Complete search
Skill types: Complete search

Starter code:

Solutions:
def palindrome(a):
	x = ''
	for i in range(len(a) - 1, -1, -1):
		x += a[i]
	if x == a:
		return 1
	else:
		return 0
k = input()
n = int(input())
f = 'YES'
if len(k) % n == 0:
	for i in range(0, len(k), len(k) // n):
		if palindrome(k[i:i + len(k) // n]) == 0:
			f = 'NO'
	print(f)
else:
	print('NO')


b = input()
b = str(b)
a = input()
a = int(a)
if len(b) % a != 0:
	print('NO')
else:
	kol = len(b) / a
	kol = int(kol)
	b = b + ' '
	flag = 0
	for i in range(a):
		if b[i * kol:i * kol + kol] == b[i * kol + kol - 1:i * kol:-1] + b[i * kol]:
			flag += 1
	if flag == a:
		print('YES')
	else:
		print('NO')


import sys
S = input()
K = int(input())

def is_palindrome(s):
	return s == s[::-1]

def split_string(s, length):
	if len(s) == 0:
		return []
	else:
		return [s[:length]] + split_string(s[length:], length)
if len(S) % K != 0:
	print('NO')
else:
	length = int(len(S) / K)
	for substr in split_string(S, length):
		if not is_palindrome(substr):
			print('NO')
			sys.exit(0)
	print('YES')


s = str(input())
k = int(input())
if len(s) % k != 0:
	print('NO')
else:
	l = len(s) // k
	for i in range(k + 1):
		x = s[i * l:l * (i + 1):1]
		if x != x[::-1]:
			print('NO')
			exit()
	print('YES')


slovo = input()
num = int(input())
if len(slovo) % num == 0:
	dlina = len(slovo) // num
	for i in range(num):
		new_slovo = slovo[dlina * i:dlina * (i + 1)]
		if new_slovo != new_slovo[::-1]:
			print('NO')
			break
	else:
		print('YES')
else:
	print('NO')


import math
tar = input()
k = int(input())
n = len(tar)
all = []
ans = True
if n % k != 0:
	print('NO')
	exit()
for i in range(0, k):
	all.append(tar[int(i * n / k):int((i + 1) * (n / k))])
	x = int(math.ceil(n / k / 2))
	tt = all[i][0:x]
	if int(n / k) % 2 == 1:
		x -= 1
	ans &= tt == all[i][x:int(math.ceil(n / k))][::-1]
if ans:
	print('YES')
else:
	print('NO')


def ispalindrome(s):
	s_ = [x for x in s]
	if s == ''.join(list(reversed(s_))):
		return True
	else:
		return False
s = input()
k = int(input())
if len(s) % k != 0:
	print('NO')
else:
	flag = True
	n = len(s) // k
	for i in range(k):
		if not ispalindrome(s[i * n:(i + 1) * n]):
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


line = str(input())
n = int(input())
if len(line) % n > 0:
	print('NO')
else:
	level = len(line) // n
	list_0 = list()
	list_1 = list()
	for i in range(n):
		list_0.append(line[i * level:(i + 1) * level])
	line = line[::-1]
	for i in range(n):
		list_1.append(line[i * level:(i + 1) * level])
	list_0.sort()
	list_1.sort()
	if list_0 == list_1:
		print('YES')
	else:
		print('NO')


def check_palindrom(inp):
	for i in range(len(inp) // 2):
		if inp[i] != inp[len(inp) - 1 - i]:
			return False
	return True

def main():
	string = input()
	number = int(input())
	if len(string) / number != int(len(string) / number):
		print('NO')
		return 0
	else:
		for i in range(number):
			if not check_palindrom(string[i * len(string) // number:(i + 1) * len(string) // number]):
				print('NO')
				return 0
		print('YES')
main()


a = list(input())
n = int(input())
b = []
p = []
if len(a) % n != 0:
	print('NO')
	exit()
else:
	l = len(a) // n
	for i in range(l, len(a) + 1, l):
		c = a[i - l:i]
		b.append(c)
for i in range(len(b)):
	for j in range(len(b[i]) - 1, -1, -1):
		p.append(b[i][j])
	if p != b[i]:
		print('NO')
		exit()
	p = []
print('YES', end='')


s = lambda w: w == w[::-1]
f = lambda w, n, k: w[n * k:n * (k + 1)]
m = input()
w = int(input())
length = len(m)
if length % w != 0:
	print('NO')
else:
	w = [f(m, length // w, k) for k in range(w)]
	if all(map(s, w)):
		print('YES')
	else:
		print('NO')


def main():
	str = input()
	k_first_symbols = len(str)
	k_letters = int(input())
	if len(str) % k_letters != 0:
		print('NO')
	else:
		polindrom_list = []
		for x in range(int(k_letters)):
			polindrom_list.append(str[0:int(k_first_symbols / k_letters)])
			str = str[int(k_first_symbols / k_letters):len(str)]
		all_polindromes = True
		for x in polindrom_list:
			rev_x = x[::-1]
			if x != rev_x:
				all_polindromes = False
		if all_polindromes:
			print('YES')
		else:
			print('NO')
main()


def esPalindromo(palabra, nroLetras):
	i = 0
	j = nroLetras - 1
	espal = True
	while j > i:
		if palabra[j] != palabra[i]:
			espal = False
			break
		i += 1
		j -= 1
	return espal
contenidos = input()
nroMensajes = int(input())
nroLetras = len(contenidos) // nroMensajes
if nroLetras * nroMensajes != len(contenidos):
	print('NO')
else:
	i = 0
	todosson = True
	while i < len(contenidos):
		todosson = todosson and esPalindromo(contenidos[i:i + nroLetras], nroLetras)
		i += nroLetras
	if todosson:
		print('YES')
	else:
		print('NO')


def pal(s):
	return s == s[::-1]
a = input()
n = int(input())
k = len(a) // n
ok = len(a) % n == 0
for i in range(n):
	ok &= pal(a[i * k:(i + 1) * k])
if ok:
	print('YES')
else:
	print('NO')


import math
buffer = input()
buffer2 = int(input())
size = int(len(buffer) / buffer2)
a = []
sema = 0
if len(buffer) % buffer2 > 0:
	sema = 1
for i in range(0, buffer2):
	a.append(buffer[i * size:i * size + size])
for i in a:
	ir = i[::-1]
	if i != ir:
		sema = 1
if sema == 1:
	print('NO')
else:
	print('YES')


def isPan(L, l, r):
	for i in range(0, (r - l) // 2 + 1):
		if L[l + i] != L[r - i]:
			return False
	return True
S = list(input())
k = int(input())
if len(S) % k != 0:
	print('NO')
else:
	length = len(S) // k
	f = 1
	for i in range(k):
		if not isPan(S, length * i, length * (i + 1) - 1):
			f = 0
			break
	if f:
		print('YES')
	else:
		print('NO')


s = input()
k = int(input())
length = len(s)
tokenLength = length / k
if length % k != 0:
	print('NO')
	return
for i in range(k):
	toCheck = s[i * int(tokenLength):i * int(tokenLength) + int(tokenLength)]
	if toCheck != toCheck[::-1]:
		print('NO')
		return
print('YES')


from sys import *

def pol(s):
	n = len(s)
	for i in range(n // 2 + 1):
		if s[i] != s[-1 - i]:
			return False
	return True
s = input()
k = int(input())
if len(s) % k == 0:
	n = len(s) // k
	for i in range(k):
		if not pol(s[0:n]):
			print('NO')
			return
		s = s[n:]
	print('YES')
else:
	print('NO')


def palindrome(s):
	s = list(s)
	p = s[::-1]
	if s == p:
		return True
	else:
		return False
s = input()
k = int(input())
if len(s) % k != 0:
	print('NO')
	exit()
p = len(s) // k
for i in range(0, len(s), p):
	if not palindrome(s[i:i + p]):
		print('NO')
		exit()
print('YES')


string = str(input())
n = int(input())
if len(string) % n != 0:
	print('NO')
	exit(0)
upd = int(len(string) / n)
(output, p) = (1, 0)
while p < len(string):
	(p1, p2) = (p, p + upd - 1)
	while p1 < p2:
		if string[p1] != string[p2]:
			output = 0
			break
		p1 += 1
		p2 -= 1
	p += upd
if output == 0:
	print('NO')
else:
	print('YES')


import sys
import math
import time
import random
import functools

def pal(x):
	for i in range(len(x) // 2):
		if x[i] != x[len(x) - i - 1]:
			return False
	return True
s = input()
k = int(input())
l = 0
if len(s) % k == 0:
	l = len(s) // k
else:
	print('NO')
	return
for i in range(k):
	q = ''
	for j in range(l * i, l * i + l):
		q += s[j]
	if not pal(q):
		print('NO')
		return
print('YES')


s = list(input())
k = int(input())
le = len(s)
if le % k:
	print('NO')
else:
	s = ['1'] + s
	lek = le // k
	for i in range(k):
		if s[lek * i + 1:lek * (i + 1) + 1] != s[lek * (i + 1):lek * i:-1]:
			print('NO')
			break
	else:
		print('YES')


def palindrome(_str: list, num: int) -> bool:
	for i in range(int(num / 2)):
		if _str[i] != _str[len(_str) - i - 1]:
			return False
	return True
string = list(input())
number = int(input())
length = int(len(string) / number)
if len(string) == 1 and number == 1:
	print('YES')
elif number > len(string):
	print('NO')
else:
	count = 0
	while len(string) > 0:
		if palindrome(string[:length], length):
			count += 1
			string = string[length:]
		else:
			break
	if count == number:
		print('YES')
	else:
		print('NO')


import sys
s = input()
k = int(input())
n = len(s)
if n % k != 0:
	print('NO')
	sys.exit()

def isPalindrome(s):
	if len(s) == 0 or len(s) == 1:
		return True
	if s[0] == s[-1]:
		return isPalindrome(s[1:-1])
	return False
l = n // k
for i in range(0, k):
	if not isPalindrome(s[i * l:i * l + l]):
		print('NO')
		sys.exit()
print('YES')


def palin(ss):
	for i in range(len(ss) // 2):
		if ss[i] != ss[len(ss) - i - 1]:
			return False
	return True

def main():
	s = input()
	k = int(input())
	l = len(s)
	if l % k:
		return False
	else:
		t = l // k
		for i in range(k):
			if not palin(s[i * t:i * t + t]):
				return False
	return True
if main():
	print('YES')
else:
	print('NO')


s = input()
k = int(input())
if len(s) % k != 0:
	print('NO')
	exit(0)
a = len(s) // k
i = 0
j = a
while i <= len(s) + 1:
	b = s[i:j]
	if b != b[::-1]:
		print('NO')
		exit(0)
	i = i + a
	j = j + a
print('YES')


m = str(input())
z = int(input())

def pol(s):
	for i in range(int(len(s) / 2)):
		if not s[i] == s[len(s) - 1 - i]:
			return False
			break
	return True
l = len(m)
l1 = int(l / z)
start = 0
end = l1
if len(m) < z or not l % z == 0:
	print('NO')
	return
for j in range(z):
	u = m[start:end]
	start += l1
	end += l1
	if not pol(u):
		print('NO')
		return
print('YES')


from math import floor

def is_p(s):
	for i in range(floor(len(s) / 2)):
		if s[i] != s[len(s) - i - 1]:
			return False
	return True
s = input()
k = int(input())
result = True
if k > len(s):
	result = False
p = len(s) / k
if p != floor(p):
	result = False
else:
	p = int(abs(p))
if not result:
	print('NO')
	exit()
for i in range(k):
	si = s[i * p:(i + 1) * p]
	if len(si) != p:
		result = False
		break
	result = result and is_p(si)
print('YES' if result else 'NO')


def isPal(s):
	return all((s[i] == s[len(s) - i - 1] for i in range(len(s) // 2)))
s = input().strip()
k = int(input().strip())
n = len(s)
if n % k:
	print('NO')
else:
	print(['NO', 'YES'][all((isPal(s[i:i + n // k]) for i in range(0, n, n // k)))])


s = input()
n = int(input())
k = len(s)
if k < n:
	print('NO')
	exit()
elif k % n != 0:
	print('NO')
	exit()
else:
	for i in range(0, k, k // n):
		p = s[i:i + k // n]
		if p != p[::-1]:
			print('NO')
			exit()
print('YES')


s = str(input())
n = int(input())
width = len(s) // n
if len(s) % n != 0:
	print('NO')
	exit()
for i in range(n):
	s_slice = s[i * width:(i + 1) * width]
	if s_slice != s_slice[::-1]:
		print('NO')
		break
else:
	print('YES')


def isPalindrome(t):
	for i in range(len(t) // 2):
		if t[i] != t[len(t) - i - 1]:
			return False
	return True
s = input()
k = int(input())
if len(s) % k:
	print('NO')
else:
	t = len(s) // k
	for i in range(k):
		if not isPalindrome(s[i * t:i * t + t]):
			print('NO')
			break
	else:
		print('YES')


def pal(s):
	n = len(s)
	for i in range(n):
		if s[i] != s[n - i - 1]:
			return False
	return True
s = input()
k = int(input())
ans = 'NO'
if len(s) % k == 0:
	n = len(s) // k
	for i in range(k):
		if not pal(s[n * i:n * (i + 1)]):
			break
	else:
		ans = 'YES'
print(ans)


def checkpal(s):
	if s == s[::-1]:
		return True
	return False
s = input()
k = int(input())
n = len(s)
if n % k == 0:
	co = True
	size = n // k
	while len(s) > 0 and co:
		if not checkpal(s[:size]):
			co = False
		s = s[size:]
	if co:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


s = input()
k = int(input())

def solve(s, k):
	if k == 0:
		return False if len(s) > 0 else True
	if len(s) % k != 0:
		return False
	cl = len(s) / k
	for i in range(k):
		if s[int(i * cl):int((i + 1) * cl)] != s[int(i * cl):int((i + 1) * cl)][::-1]:
			return False
	return True
print('YES' if solve(s, k) else 'NO')


import math

def main():
	s = input()
	k = int(input())
	ns = len(s)
	if ns % k != 0:
		print('NO')
		return
	k = int(ns / k)
	while len(s) > 0:
		crt = s[:k]
		crt1 = crt[::-1]
		s = s[k:]
		if crt != crt1:
			print('NO')
			return
	print('YES')

def __starting_point():
	main()
__starting_point()


__author__ = 'Esfandiar'
s = input()
Len = len(s)
k = int(input())
y = Len // k
print('YES' if Len % k == 0 and all((s[i:i + y] == ''.join(reversed(s[i:i + y])) for i in range(0, Len, y))) else 'NO')


(s, k) = (input(), int(input()))
m = len(s) // k if not len(s) % k else 9999999
b = all([j == j[::-1] for j in [s[i:i + m] for i in range(0, len(s), m)]])
print('NO' if not b or len(s) % k else 'YES')


import sys
import math
import bisect

def solve(s, k):
	n = len(s)
	if n % k:
		return False
	for i in range(0, n, n // k):
		t = s[i:i + n // k]
		if t != t[::-1]:
			return False
	return True

def main():
	s = input()
	k = int(input())
	if solve(s, k):
		print('YES')
	else:
		print('NO')
main()


def main():
	s = input()
	n = int(input())
	(plen, mod) = divmod(len(s), n)
	print('YES' if mod == 0 and all((s[i:i + plen] == s[i:i + plen][::-1] for i in range(0, len(s), plen))) else 'NO')
main()


s = input()
k = int(input())

def palindrom(a):
	n = len(a)
	for i in range(0, len(a) // 2):
		if a[i] != a[n - i - 1]:
			return False
	else:
		return True
count = 0
lens = len(s)
if lens % k == 0:
	temp = lens // k
	initial = 0
	for i in range(1, k + 1):
		if palindrom(s[initial:temp * i]):
			count += 1
		initial = temp * i
	if count == k:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


st = input()
n = int(input())
if len(st) % n:
	print('NO')
	exit()
l = len(st) // n
for _ in range(0, len(st), l):
	tmp = st[_:_ + l]
	if tmp != tmp[::-1]:
		print('NO')
		exit()
print('YES')


s = input()
k = int(input())
n = len(s) // k
y = n
f = 0
if len(s) % k != 0:
	print('NO')
else:
	i = 0
	while i < len(s):
		r = s[i:n]
		if r != r[::-1]:
			print('NO')
			f = 1
			break
		i += y
		n += y
	if f == 0:
		print('YES')


s = input()
n = int(input())
msg = len(s) // n
if len(s) // n == len(s) / n:
	l1 = []
	for i in range(0, len(s), msg):
		l1.append(s[i:i + msg])
	count = 0
	for i in l1:
		if i == i[::-1]:
			count += 1
	if count == n:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


s = input()
k = int(input())
L = round(len(s) / k)
p = []
f = []
if len(s) % k == 0:
	for i in range(0, k):
		p.append(s[:L])
		s = s[L:]
	for l in range(0, len(p)):
		L = p[l]
		if L == L[::-1]:
			f.append(L)
	if len(f) == len(p):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


s = input()
b = [int(s) for s in input().split()][0]
a = list()
if len(s) % b:
	print('NO')
else:
	for i in range(0, len(s) - len(s) // b + 1, len(s) // b):
		a.append(s[i:i + len(s) // b])
	for i in a:
		if not i == i[::-1]:
			print('NO')
			break
	else:
		print('YES')


import sys
input = []
input_index = 0

def next(type, number=None):

	def next():
		global input, input_index
		if input_index == len(input):
			if sys.stdin:
				input = sys.stdin.readline().split()
				input_index = 0
			else:
				raise Exception()
		input_index += 1
		return input[input_index - 1]
	if number is None:
		result = type(next())
	else:
		result = [type(next()) for _ in range(number)]
	return result
s = next(str)
k = next(int)
if len(s) % k == 0:
	result = True
	l = len(s) // k
	ss = [s[i * l:(i + 1) * l] for i in range(k)]
	for s in ss:
		(l, u) = (0, len(s) - 1)
		while l < u:
			if s[l] != s[u]:
				result = False
				break
			l += 1
			u -= 1
		if not result:
			break
	print('YES' if result else 'NO')
else:
	print('NO')


s = input()
n = int(input())
l = len(s)
m = l // n
if l % n != 0:
	print('NO')
else:
	m = l // n
	c = 0
	for i in range(0, l - m + 1, m):
		p = s[i:i + m]
		if p == p[::-1]:
			c += 1
	if c == n:
		print('YES')
	else:
		print('NO')


s = input()
k = int(input())
z = len(s)
if z % k != 0:
	print('NO')
else:

	def palindrome(s):
		x = []
		y = []
		for i in range(len(s)):
			x.append(s[i])
		for i in range(len(s) - 1, -1, -1):
			y.append(s[i])
		if x == y:
			return 1
		else:
			return 'no'
	z = z // k
	x = []
	for i in range(k):
		x.append(s[i * z:i * z + z])
	f = 'YES'
	for i in range(len(x)):
		if palindrome(x[i]) != 1:
			f = 'NO'
			break
	print(f)


s = input()
n = int(input())
cnt = 0
if len(s) % n != 0 or len(s) < n:
	print('NO')
else:
	for i in range(0, len(s), len(s) // n):
		if s[i:i + len(s) // n] == s[i:i + len(s) // n][::-1]:
			cnt += 1
	if cnt == n:
		print('YES')
	else:
		print('NO')


import math

def prefix(t, p):
	k = 0
	for i in range(1, len(t)):
		k = p[i - 1]
		while k > 0 and t[k + 1] != t[i]:
			k = p[k]
		if t[k + 1] == t[i]:
			k = k + 1
		p[i] = k

def search_podstroki(s, t):
	t1 = t + '$' + s
	p = [-1] * len(t1)
	prefix(t1, p)
	c1 = 0
	set_ = {}
	for i in range(1, len(t1)):
		if p[i] == len(t) - 1:
			c1 = -1
	if c1 == -1:
		return True
	else:
		return False

def ispalindrome(l, r, s, x):
	m = math.floor((l + r) / 2)
	if m < 1:
		r = r * 2
		s1 = s[l:round(r / 2)]
		s2 = s[round(r / 2):r]
		if search_podstroki(s1, s2) == True:
			x = k
	elif (l + r) % 2 == 0:
		s1 = s[l:m]
		s2 = s[m:r]
		s2 = s2[::-1]
		if search_podstroki(s1, s2) == True:
			x = x + 1
	else:
		s1 = s[l:m]
		s2 = s[m + 1:r]
		s2 = s2[::-1]
		if search_podstroki(s1, s2) == True:
			x = x + 1
	return x
s = input()
k = int(input())
x = 0
s.rstrip()
if len(s) % k != 0:
	print('NO')
elif len(s) == k:
	print('YES')
else:
	h = round(len(s) / k)
	r = 0
	i = 0
	while i <= len(s):
		l = r
		r = l + h
		x = ispalindrome(l, r, s, x)
		i = r
	if x == k:
		print('YES')
	else:
		print('NO')


__author__ = 'Snopi'
s = input()
k = int(input())
if len(s) % k != 0:
	print('NO')
	exit(0)
o = len(s) // k
for j in range(k):
	lal = s[j * o:(j + 1) * o]
	if lal != ''.join(reversed(lal)):
		print('NO')
		exit(0)
print('YES')


import sys
from operator import itemgetter

def main():
	s = sys.stdin.readline()
	s = s.split()[0]
	k = int(sys.stdin.readline())
	if len(s) % k != 0:
		print('NO')
	else:
		L = int(len(s) / k)
		broken = 0
		for i in range(k):
			a = s[i * L:(i + 1) * L:1]
			if not a.endswith(a[::-1]):
				print('NO')
				broken = 1
				break
		if broken == 0:
			print('YES')
main()


s = input()
k = int(input())
n = len(s) // k
if n * k != len(s):
	print('NO')
else:
	p = 0
	f = True
	for i in range(k):
		z = s[p:p + n]
		r = ''
		for x in z:
			r = x + r
		if z != r:
			f = False
			break
		p += n
	if f:
		print('YES')
	else:
		print('NO')


s = input()
n = int(input())
l = len(s)
if l % n != 0:
	print('NO')
else:
	k = l // n
	for i in range(k, l, k):
		if s[i:i + k] != s[i + k - 1:i - 1:-1]:
			print('NO')
			break
	else:
		if s[:k] != s[k - 1::-1]:
			print('NO')
		else:
			print('YES')


n = input().strip()
l = int(input().strip())
j = len(n) // l
o = 0
t = True
if len(n) % l == 0:
	for i in range(0, l):
		k = n[o:o + j]
		if k != k[-1::-1]:
			t = False
		o = o + j
	if t == True:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


def palindrome(s):
	reverse = ''
	rev_ind = -1
	for i in range(len(s)):
		reverse += s[rev_ind]
		rev_ind -= 1
	return s == reverse
s = input()
l = len(s)
k = int(input())
if k == 0:
	if palindrome(s):
		print('YES')
	else:
		print('NO')
elif l % k == 0:
	index_increment = l // k
	pal_flag = 1
	substr_ind = 0
	last_index = l - index_increment
	substr_list = []
	while substr_ind <= last_index:
		substr_list.append(s[substr_ind:substr_ind + index_increment])
		substr_ind += index_increment
	for substr in substr_list:
		if palindrome(substr) == False:
			pal_flag = 0
	if pal_flag:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


import os
import sys
from math import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def array():
	return [int(i) for i in input().split()]
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
s = input()
k = int(input())
if len(s) % k != 0:
	print('NO')
else:
	size = len(s) // k
	f = 1
	i = 0
	while i + size <= len(s):
		t = s[i:i + size]
		if t != t[::-1]:
			f = 0
			break
		i += size
	if f == 1:
		print('YES')
	else:
		print('NO')


def ispalindrome(word):
	if len(word) < 2:
		return True
	if word[0] != word[-1]:
		return False
	return ispalindrome(word[1:-1])
flag = 0
s = input()
k = int(input())
l = len(s) / k
if l - int(l):
	print('NO')
	flag = 1
if flag == 0:
	l = int(len(s) / k)
	for i in range(1, k + 1):
		if not ispalindrome(s[i * l - l:i * l]):
			print('NO')
			flag = 1
			break
if flag == 0:
	print('YES')


from collections import *
s = input()
k = int(input())
n = len(s) // k
if len(s) % k != 0:
	print('NO')
	exit(0)
for i in range(0, len(s), n):
	t = s[i:i + n]
	if t != t[::-1]:
		print('NO')
		break
else:
	print('YES')


s = input()
n = int(input())
l = len(s)
if l % n != 0:
	print('NO')
else:
	flag = True
	avg = l // n
	for i in range(0, l, avg):
		if s[i:i + avg] != s[i:i + avg][::-1]:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


import sys

def check(s, i, j):
	while i <= j:
		if s[i] != s[j]:
			return False
		i += 1
		j -= 1
	return True
s = input()
k = int(input())
i = int(0)
l = int(len(s))
d = int(l / k)
j = int(d - 1)
if l % k:
	print('NO')
	sys.exit()
cnt = int(0)
if s[0:4] == 'gxvu':
	print('NO')
	sys.exit()
while j < l:
	if check(s, i, j) == False:
		print('NO')
		sys.exit()
	cnt += 1
	i += d
	j += d
if cnt > k or cnt < k:
	print('NO')
	sys.exit()
print('YES')
sys.exit()


s = input()
k = int(input())
from functools import reduce
if not len(s) % k and reduce(lambda boo, t: boo & (t == t[::-1]), (s[x * len(s) // k:(x + 1) * len(s) // k] for x in range(k)), 1):
	print('YES')
else:
	print('NO')


s = input()
k = int(input())
if k > len(s):
	print('NO')
else:
	l_sub = len(s) // k
	if len(s) % k != 0:
		print('NO')
	else:
		l = []
		i = 0
		x = l_sub
		while i != len(s):
			l.append(s[i:x])
			i += l_sub
			x = x + l_sub
		if all((i == i[::-1] for i in l)):
			print('YES')
		else:
			print('NO')


s = input()
k = int(input())
leng = len(s) // k
ans = 'YES'
if len(s) % k != 0:
	ans = 'NO'
for i in range(k):
	a = s[i * leng:(i + 1) * leng]
	if a != a[::-1]:
		ans = 'NO'
print(ans)


s = input()
k = int(input())
if k % 2 == 0 and len(s) % 2 == 1 or k > len(s):
	print('NO')
else:
	l = []
	n = len(s) // k
	for i in range(0, len(s), n):
		l.append(s[i:i + n])
	t = ''
	ans = 0
	for i in l:
		t = i[::-1]
		if i == t:
			ans += 1
	if ans == k:
		print('YES')
	else:
		print('NO')


def poly(s):
	n = len(s)
	return s[:n // 2] == s[-1:(n - 1) // 2:-1]
s = input()
k = int(input())
n = len(s)
if n % k != 0:
	print('NO')
else:
	m = n // k
	print('YES' if all((poly(s[i * m:(i + 1) * m]) for i in range(k))) else 'NO')


s = input()
k = int(input())
l = len(s)
flag = True
if l % k != 0:
	print('NO')
else:
	for i in range(0, l, l // k):
		s1 = s[i:i + l // k]
		s2 = s1[::-1]
		if s1 == s2:
			continue
		else:
			print('NO')
			flag = False
			break
	if flag == True:
		print('YES')


def is_pol(s, l, i):
	seq = s[i:i + l]
	for i in range(int(l / 2)):
		if not seq[i] == seq[-i - 1]:
			return False
	return True
s = input()
k = int(input())
length = len(s)
small_length = length / k
if small_length != int(small_length):
	print('NO')
elif length < k:
	print('NO')
else:
	small_length = int(length / k)
	for i in range(0, length, small_length):
		if not is_pol(s, small_length, i):
			print('NO')
			break
	else:
		print('YES')


s = input()
k = int(input())

def main(s, k):
	if len(s) % k:
		return 'NO'
	for i in range(0, len(s), len(s) // k):
		j = i + len(s) // k - 1
		for m in range(len(s) // k):
			if s[i + m] != s[j - m]:
				return 'NO'
	return 'YES'
print(main(s, k))


def is_palindrome(s):
	i = 0
	j = len(s) - 1
	while i < j:
		if s[i] != s[j]:
			return False
		i += 1
		j -= 1
	return True

def solve(s, k):
	if len(s) % k != 0:
		return False
	n = len(s) // k
	for i in range(0, len(s), n):
		if not is_palindrome(s[i:i + n]):
			return False
	return True
s = input()
k = int(input())
print('YES' if solve(s, k) else 'NO')


s = input()
n = int(input())
l = len(s)
if l % n != 0:
	print('NO')
else:
	for i in range(0, l, l // n):
		temp = s[i:l // n + i]
		rev = temp[::-1]
		if temp == rev:
			continue
		else:
			print('NO')
			exit(0)
			break
	print('YES')


def pali(elem):
	for i in range(len(elem) // 2):
		if elem[i] != elem[len(elem) - i - 1]:
			return False
	return True

def check(l):
	for elem in l:
		if not pali(elem):
			return False
	return True
s = input()
k = int(input())
if len(s) % k == 0:
	k = len(s) // k
	l = [s[i:i + k] for i in range(0, len(s), k)]
	yes = check(l)
	if yes:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


s = input()
k = int(input())

def solve(s, k):
	if len(s) % k > 0:
		print('NO')
		return
	l = len(s) // k
	for i in range(k):
		for j in range(l // 2):
			if s[i * l + j] != s[i * l + l - j - 1]:
				print('NO')
				return
	print('YES')
solve(s, k)


s = input()
k = int(input())
n = len(s)
if n % k:
	print('NO')
else:
	le = n // k
	ok = 1
	for i in range(0, n, le):
		for j in range(le):
			if s[i + j] != s[i + le - 1 - j]:
				ok = 0
	print('YES' if ok else 'NO')


s = input()
k = int(input())
l = len(s)
if l % k != 0:
	print('NO')
else:
	n = int(l / k)
	ch = True
	for i in range(k):
		s1 = s[i * n:i * n + n]
		if str(s1) != str(s1)[::-1]:
			print('NO')
			ch = False
			break
	if ch:
		print('YES')


s = input()
n = int(input())
ls = len(s)
if ls % n != 0:
	print('NO')
elif n == 1:
	if s == s[::-1]:
		print('YES')
	else:
		print('NO')
elif n > 1:
	a = 0
	b = ls // n
	k = 0
	while b <= ls:
		tmp = s[a:b]
		if tmp == tmp[::-1]:
			k += 1
		a = b
		b += ls // n
	if k == n:
		print('YES')
	else:
		print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect
from itertools import chain, dropwhile, permutations, combinations
from collections import defaultdict

def VI():
	return list(map(int, input().split()))

def main(s, k):
	n = len(s)
	if n % k != 0:
		print('NO')
		return
	d = n // k
	for i in range(0, n, d):
		if s[i:i + d] != s[i:i + d][::-1]:
			print('NO')
			return
	print('YES')

def main_input(info=0):
	s = input()
	k = int(input())
	main(s, k)
main_input()


(s, k) = (input(), int(input()))
l = len(s) // k
u = [s[i::l] for i in range(l)]
print(['NO', 'YES'][u == u[::-1] and l * k == len(s)])


import sys
a = input()
a = list(a)
k = int(input())
if len(a) % k != 0:
	print('NO')
	sys.exit()
if len(a) == 1:
	if k == 1:
		print('YES')
		sys.exit()
	else:
		print('NO')
		sys.exit()
if len(set(a)) == 1 and len(a) == k:
	print('YES')
	sys.exit()
if len(set(a)) == k and len(a) == k:
	print('YES')
	sys.exit()
na = []
j = 0
h = int(len(a) / k - 1)
c = int(len(a) / k)
for i in range(k):
	na.append(a[j:h + 1])
	j = h + 1
	h += c
u = 9999
g = 0
f = int(len(na[0]) / 2)
for i in range(len(na)):
	l = len(na[i])
	for j in range(l // 2):
		if na[i][j] != na[i][-1 - j]:
			u = u
		else:
			g += 1
ng = g // f
if ng == k:
	print('YES')
else:
	print('NO')


word = input()
l = int(input())
if len(word) % l != 0:
	print('NO')
else:
	for i in range(0, len(word), len(word) // l):
		w = word[i:i + len(word) // l]
		if w != w[::-1]:
			print('NO')
			break
	else:
		print('YES')


__author__ = 'y'

def is_palindrome(xs):
	l = len(xs)
	for i in range(l // 2):
		if xs[i] != xs[l - 1 - i]:
			return False
	return True
s = input()
len_s = len(s)
k = int(input())
if len_s // k * k == len_s:
	ss = [s[start:start + len_s // k] for start in range(0, len(s), len_s // k)]
	ps = map(is_palindrome, ss)
	if all(ps):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


Message = input()
FaxesNumber = int(input())
NumberoFSeb = 0
Conti = True
if len(Message) % FaxesNumber == 0:
	for i in range(FaxesNumber):
		Lenn = len(Message) / FaxesNumber * (i + 1)
		Message1 = Message[int(NumberoFSeb):int(Lenn)]
		if Message1 != ''.join(reversed(Message1)):
			Conti = False
			break
		NumberoFSeb += len(Message) / FaxesNumber
else:
	Conti = False
if Conti == False:
	print('NO')
else:
	print('YES')


def verif(mot):
	cond = True
	for i in range(len(mot) // 2):
		if not mot[i] == mot[-i - 1]:
			return False
	return True
s = input()
n = int(input())
buf = True
if len(s) % n != 0:
	print('NO')
else:
	for i in range(0, len(s), len(s) // n):
		buf = buf and verif(s[i:i + len(s) // n])
		if not buf:
			print('NO')
			break
	if buf:
		print('YES')


x = input()
n = int(input())
if len(x) % n == 0:
	l = len(x) // n
else:
	print('NO')
	exit(0)
for i in range(n):
	v = x[i * l:(i + 1) * l]
	if v != v[::-1]:
		print('NO')
		exit(0)
print('YES')


import math
import sys
s = input()
k = int(input())
index = int(len(s) / k)
if len(s) / k - index != 0:
	print('NO')
	sys.exit(0)

def check(s):
	for i in range(len(s)):
		if s[i] == s[len(s) - 1 - i]:
			pass
		else:
			return False
	return True
for i in range(k):
	if not check(s[i * index:i * index + index]):
		print('NO')
		sys.exit(0)
print('YES')


s = list(input())
k = int(input())
if len(s) % k != 0:
	print('NO')
else:
	n = len(s) // k
	x = 0
	f = 0
	for i in range(k):
		f = 0
		m = 0
		for j in range(x, x + n // 2):
			if s[j] != s[x + n - 1 - m]:
				f = 1
				break
			m += 1
		x += n
		if f == 1:
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


a = input()
b = int(input())
if len(a) % b:
	print('NO')
else:
	c = len(a) // b
	d = True
	for i in range(b):
		e = a[i * c:(i + 1) * c]
		if e != e[::-1]:
			d = False
			print('NO')
			break
	if d:
		print('YES')


v = input()
n = len(v)
k = int(input())
if n % k:
	print('NO')
else:
	k = len(v) // k
	print('YES' if sum((v[i:i + k] == v[i + k - 1:i - 1 if i != 0 else None:-1] for i in range(0, len(v), k))) == len(v) // k else 'NO')


__author__ = 'k0t'
s = input()
n = int(input())
if len(s) % n != 0:
	print('NO')
	exit(0)
count = len(s) // n
(n, count) = (count, n)
for i in range(0, count):
	ss = s[i * n:(i + 1) * n]
	if all((ss[j] == ss[len(ss) - j - 1] for j in range(0, len(ss)))):
		continue
	else:
		print('NO')
		exit(0)
print('YES')


s = input()
k = int(input())
if len(s) % k != 0:
	print('NO')
	exit()
for i in range(0, len(s), len(s) // k):
	ss = s[i:i + len(s) // k]
	if ss[0:(len(ss) + 1) // 2] != ss[-((len(ss) + 1) // 2):][::-1]:
		print('NO')
		break
else:
	print('YES')


string = input()
k = int(input())
l = len(string) // k
if l == 0:
	print('NO')
else:
	yes = True
	for i in range(len(string) // l):
		if string[l * i:l * (i + 1)] != string[l * i:l * (i + 1)][::-1]:
			yes = False
			break
	if yes and len(string) % k == 0:
		print('YES')
	else:
		print('NO')


def check_pal(s):
	mid = int(len(s) / 2)
	i = 0
	j = len(s) - 1
	while i <= mid:
		if s[i] != s[j]:
			return 0
		i += 1
		j -= 1
	return 1
s = input()
k = int(input())
flag = 0
if k > len(s):
	flag = 1
if len(s) % k != 0:
	flag = 1
lb = int(len(s) / k)
i = 0
if flag == 0:
	while i < len(s):
		check = check_pal(s[i:i + lb])
		if check == 0:
			flag = 1
			break
		i += lb
if flag == 0:
	print('YES')
else:
	print('NO')


s = str(input())
k = 0
o = 0
n = int(input())
p = len(s) // n
if len(s) % n != 0:
	o = 1
	print('NO')
if o == 0:
	out = [s[i:i + p] for i in range(0, len(s), p)]
	for i in out:
		rev = ''.join(reversed(i))
		if i != rev:
			k = 1
			break
	if k == 1:
		print('NO')
	else:
		print('YES')


s = input().strip()
n = len(s)
k = int(input())
if n % k != 0:
	print('NO')
else:
	t = n // k
	for i in range(k):
		si = s[i * t:(i + 1) * t]
		if si != si[::-1]:
			print('NO')
			break
	else:
		print('YES')


s = input()
k = int(input())
n = len(s)
c = 0
kk = n // k
if n % k == 0:
	for i in range(0, n, kk):
		x = s[i:i + kk]
		if x == x[::-1]:
			c = c + 1
	if c == k:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


def solve():

	def check(s):
		for i in range(len(s)):
			if s[i] != s[len(s) - i - 1]:
				return 0
		return 1
	ins = input()
	k = int(input())
	l = len(ins) // k
	if len(ins) % k != 0:
		print('NO')
		return 0
	for i in range(k):
		if not check(ins[i * l:i * l + l]):
			print('NO')
			return 0
	print('YES')
solve()


s = input()
k = int(input())
if len(s) % k:
	print('NO')
	exit()
a = [s[i:i + len(s) // k] for i in range(0, len(s), len(s) // k)]
if all((x == x[::-1] for x in a)):
	print('YES')
else:
	print('NO')


def ispalin(t):
	for i in range(l // k // 2):
		if t[i] != t[l // k - i - 1]:
			return 0
	return 1
s = input()
k = int(input())
l = len(s)
if l % k != 0:
	print('NO')
	exit(0)
for i in range(0, l, l // k):
	if not ispalin(s[i:i + l // k]):
		print('NO')
		exit(0)
print('YES')


s = input()
k = int(input())
s1 = len(s)

def pal(s, s1):
	if s1 % 2 == 0:
		s2 = s1 // 2
	else:
		s2 = s1 // 2 + 1
	k = 0
	for i in range(s2):
		if s[i] == s[s1 - i - 1]:
			k += 1
		else:
			break
	if k == s2:
		return 1
	else:
		return 0
m = 0
if s1 % k == 0:
	s2 = len(s) // k
	for i in range(s1):
		if i % s2 == 0:
			s3 = s[i:i + s2]
			if pal(s3, s2) == 1:
				m += 1
			else:
				break
else:
	m = 0
if m == k:
	print('YES')
else:
	print('NO')


import sys
s = input()
k = int(input())
if len(s) % k == 0:
	mid = len(s) // k
	v = mid
	start = 0
	while start >= 0 and mid <= len(s):
		piece = s[start:mid]
		if piece == piece[::-1]:
			start += v
			mid += v
		else:
			print('NO')
			exit()
	print('YES')
else:
	print('NO')


s = input()
l = len(s)
k = int(input())
res = 0
if l % k == 0:
	y = l // k
	start = 0
	while start < l:
		s1 = s[start:start + y]
		start += y
		if s1 != s1[::-1]:
			res = 1
			break
else:
	res = 1
print('YNEOS'[res::2])


def main():
	(s, k) = (input(), int(input()))
	if not len(s) % k:
		le = len(s) // k
		if all((t == t[::-1] for t in (s[i:i + le] for i in range(0, len(s), le)))):
			print('YES')
			return
	print('NO')
main()


from collections import defaultdict

def checker(s):
	if s == s[-1::-1]:
		return True
	else:
		return False
s = input()
k = int(input())
n = len(s)
if len(s) % k != 0:
	print('NO')
else:
	f = 0
	for i in range(0, n, n // k):
		if checker(s[i:i + n // k]) == False:
			f = 1
	if f == 1:
		print('NO')
	else:
		print('YES')


s = input()
k = eval(input())
l = len(s)
if l % k != 0:
	print('NO')
else:
	m = int(l / k)
	f = 0
	for i in range(0, k):
		tmp = s[i * m:(i + 1) * m]
		if tmp != tmp[::-1]:
			f = 1
	if f == 1:
		print('NO')
	else:
		print('YES')


import sys
s = input()
k = int(input())
count = 0
l = len(s)
if l % k != 0:
	print('NO')
	sys.exit(0)
j = l // k
i = 0
while i <= l - j:
	y = s[i:i + j]
	if y == y[::-1]:
		i = i + j
		count += 1
	else:
		i += 1
if count == k:
	print('YES')
else:
	print('NO')


def chunks(l, n):
	for i in range(0, len(l), n):
		yield l[i:i + n]

def palindrome(s):
	for i in range(len(s)):
		if s[i] != s[-(i + 1)]:
			return False
	else:
		return True
import sys
(data, num) = sys.stdin.readlines()
data = data.strip()
num = int(num.strip())
if num > len(data):
	print('NO')
elif num == len(data):
	print('YES')
elif len(data) % num == 0:
	for c in chunks(data, int(len(data) / num)):
		if not palindrome(c):
			print('NO')
			return
	else:
		print('YES')
else:
	print('NO')


(s, k) = (input(), int(input()))
if len(s) % k:
	print('NO')
	exit()
l = int(len(s) / k)
for p in (s[i * l:(i + 1) * l] for i in range(k)):
	if p != p[::-1]:
		print('NO')
		exit()
print('YES')


s = input()
k = int(input())
his = True
if len(s) % k != 0:
	print('NO')
else:
	n = len(s) // k
	start = -n
	for i in range(k):
		start += n
		t = s[start:start + n]
		if t != t[::-1]:
			his = False
			break
	if his:
		print('YES')
	else:
		print('NO')


(s, k) = (input(), int(input()))
(length, mod_) = divmod(len(s), k)
if mod_:
	print('NO')
else:
	for i in range(k):
		message = s[i * length:(i + 1) * length]
		if message != message[::-1]:
			print('NO')
			break
	else:
		print('YES')


s = input()
k = int(input())
sz = len(s) // k
if sz * k != len(s):
	print('NO')
	exit()
groups = [s[i * sz:(i + 1) * sz] for i in range(k)]
if all((i == i[::-1] for i in groups)):
	print('YES')
else:
	print('NO')


s = input()
l = len(s)
n = int(input())
if l % n != 0:
	print('NO')
else:
	a = 0
	fla = 1
	k = l / n
	for i in range(n):
		l1 = []
		for i in range(a, int(k)):
			l1.append(s[i])
		if l1 != list(reversed(l1)):
			fla = 0
			break
		else:
			a = int(k)
			k += int(l / n)
	if fla == 1:
		print('YES')
	else:
		print('NO')


def divideWord(a, n):
	cant = int(len(a) / n)
	aux = ''
	ans = []
	cont = 0
	for i in a:
		aux += i
		cont += 1
		if cont == cant:
			cont = 0
			ans.append(aux)
			aux = ''
	return ans

def isPalindrome(a):
	longitud = len(a)
	for i in range(0, int(len(a) / 2)):
		if a[i] != a[len(a) - i - 1]:
			return False
	return True

def func():
	word = input()
	n = int(input())
	if len(word) % n != 0:
		return 'NO'
	for w in divideWord(word, n):
		if not isPalindrome(w):
			return 'NO'
	return 'YES'
print(func())


s = input()
k = int(input())
p_len = len(s) // k
ans = 'YES'
if len(s) % k == 0:
	i = 0
	while i < len(s):
		if not s[i:i + p_len] == s[i:i + p_len][::-1]:
			ans = 'NO'
			break
		i += p_len
else:
	ans = 'NO'
print(ans)


s = input()
k = int(input())
if len(s) % k != 0:
	print('NO')
	exit(0)
for i in range(0, len(s), len(s) // k):
	cur = s[i:i + len(s) // k]
	if cur != cur[::-1]:
		print('NO')
		exit(0)
print('YES')


def is_palindrome(s):
	for (a, b) in zip(s, s[::-1]):
		if a != b:
			return False
	return True
s = input().strip()
k = int(input())
(q, r) = divmod(len(s), k)
if r:
	print('NO')
else:
	for i in range(k):
		if not is_palindrome(s[i * q:(i + 1) * q]):
			print('NO')
			break
	else:
		print('YES')


s = input()
k = input()
if int(k) != float(k):
	ans = 'NO'
k = int(k)
x = len(s) / k
ans = None
if x != int(x):
	ans = 'NO'
strings = []
for y in range(k):
	strings.append('')
	for i in range(int(x)):
		strings[y] += s[int(i + x * y)]
for string in strings:
	if string == string[::-1] and ans != 'NO':
		ans = 'YES'
	else:
		ans = 'NO'
print(ans)


s = input()
n = int(input())
one = len(s) // n
if len(s) % n != 0:
	print('NO')
	return
for i in range(0, len(s), one):
	our = s[i:i + one]
	if our != our[::-1]:
		print('NO')
		return
print('YES')


string = input()
k = int(input())
if int(len(string) / k) != len(string) / k:
	print('NO')
	exit()
size_block = int(len(string) / k)

def is_palindrome(pal):
	for i in range(len(pal)):
		if pal[i] != pal[-(1 + i)]:
			return False
	return True
for i in range(k):
	if not is_palindrome(string[i * size_block:(i + 1) * size_block]):
		print('NO')
		exit()
print('YES')


s = input()
k = int(input())
if len(s) % k:
	print('NO')
else:
	step = len(s) // k
	messages = [s[i:i + step] for i in range(0, len(s), step)]
	print('YES' if all((m == m[::-1] for m in messages)) else 'NO')


def palindrome(s):
	return s == s[::-1]

def pedy(s, k):
	global p
	if k == 1:
		return palindrome(s)
	d = s[:p]
	if palindrome(d):
		if pedy(s[p:], k - 1):
			return 1
	return 0
s = input()
k = int(input())
if len(s) % k:
	print('NO')
else:
	p = len(s) // k
	if pedy(s, k):
		print('YES')
	else:
		print('NO')


S = input()
k = int(input())
d = len(S) // k
r = d
j = 0
c = 0
if len(S) % k != 0:
	c = 1
for i in range(k):
	S1 = S[j:r]
	if S1 != S1[::-1]:
		c = 1
		break
	j = r
	r = r + d
if c == 1:
	print('NO')
else:
	print('YES')


s = input()
k = int(input())
ans = 'YES'
if len(s) % k != 0:
	ans = 'NO'
for i in range(k):
	x = s[len(s) // k * i:len(s) // k * (i + 1)]
	if x != x[::-1]:
		ans = 'NO'
print(ans)


def isPal(s):
	for i in range(len(s) // 2):
		if s[i] != s[-1 - i]:
			return False
	else:
		return True
s = input()
k = int(input())
if len(s) % k != 0:
	print('NO')
else:
	for i in range(0, len(s), len(s) // k):
		if not isPal(s[i:i + len(s) // k]):
			print('NO')
			break
	else:
		print('YES')


import sys
import math
import itertools
import collections

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return '\n'.join(map(str, arr))

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def pali(s):
	for i in range(len(s) // 2):
		if s[i] != s[-i - 1]:
			return False
	return True
s = input()
k = ii()
if len(s) % k != 0:
	print('NO')
else:
	dl = len(s) // k
	for i in range(k):
		if not pali(s[i * dl:(i + 1) * dl]):
			exit(print('NO'))
	print('YES')


def fax(s, k):
	if len(s) % k != 0:
		return 'NO'
	for i in range(k):
		for j in range(len(s) // k // 2):
			if s[i * (len(s) // k) + j] != s[(i + 1) * (len(s) // k) - 1 - j]:
				return 'NO'
	return 'YES'
t = input()
m = int(input())
print(fax(t, m))


s = str(input())
n = int(input())
l = []
if len(s) % n != 0:
	print('NO')
	exit()
for i in range(0, len(s), len(s) // n):
	t = s[i:i + len(s) // n]
	for j in range(len(t)):
		if t[:] != t[::-1]:
			print('NO')
			exit()
print('YES')


s = input()
a = int(input())
n = len(s)

def ispal(a, b):
	while a < b:
		if s[a] != s[b - 1]:
			return False
		a += 1
		b -= 1
	return True

def run(ispal, mul):
	for var in range(0, n, mul):
		if not ispal(var, var + mul):
			return False
	return True
if n % a != 0:
	print('NO')
elif run(ispal, int(n / a)):
	print('YES')
else:
	print('NO')


def pal(s):
	n = len(s)
	for i in range(n // 2):
		if s[i] != s[n - 1 - i]:
			return False
	return True
s = input()
n = len(s)
k = int(input())
if n % k != 0:
	print('NO')
else:
	f = 1
	for i in range(0, n, n // k):
		s1 = s[i:i + n // k]
		if pal(s1) == False:
			f = 0
			print('NO')
			break
	if f == 1:
		print('YES')


s = str(input())
k = int(input())
l = int(len(s) / k)
n = 0
cond = True
if len(s) % k != 0:
	print('NO')
	cond = False
while n <= len(s) and cond:
	if s[n:n + l] != s[n:n + l][::-1]:
		print('NO')
		cond = False
		break
	n += l
if cond == True:
	print('YES')


import sys
s = input()
k = int(input())

def isPalind(s):
	for i in range(len(s) // 2):
		if s[i] != s[len(s) - 1 - i]:
			return False
	return True
if len(s) % k != 0:
	print('NO')
else:
	l = len(s) // k
	i = 0
	while i < len(s):
		if not isPalind(s[i:i + l]):
			print('NO')
			sys.exit(0)
		i += l
	print('YES')


s = str(input())
k = int(input())
n = len(s)
if n % k != 0:
	print('NO')
else:
	c = 0
	for i in range(0, n, n // k):
		r = s[i:i + n // k]
		if r != ''.join(reversed(r)):
			c = 1
			break
	if c == 1:
		print('NO')
	else:
		print('YES')


def pali(s):
	return s == s[::-1]

def main():
	s = input()
	n = int(input())
	ll = int(len(s) / n)
	if ll != len(s) / n:
		return 'NO'
	for i in range(0, len(s), ll):
		if not pali(s[i:i + ll]):
			return 'NO'
	return 'YES'
print(main())


import sys
(s, k) = (input(), int(input()))
n = len(s)
if n % k:
	print('NO')
	sys.exit()
for i in range(0, n, n // k):
	j = i + n // k - 1
	while i < j and s[i] == s[j]:
		(i, j) = (i + 1, j - 1)
	if i < j:
		print('NO')
		sys.exit()
print('YES')


class CodeforcesTask548ASolution:

	def __init__(self):
		self.result = ''
		self.conc = ''
		self.k = 0

	def read_input(self):
		self.conc = input()
		self.k = int(input())

	def process_task(self):
		if len(self.conc) % self.k:
			self.result = 'NO'
		else:
			c_ = True
			nl = len(self.conc) // self.k
			for x in range(self.k):
				for y in range(nl):
					if self.conc[x * nl + y] != self.conc[(x + 1) * nl - y - 1]:
						c_ = False
						break
				if not c_:
					break
			self.result = 'YES' if c_ else 'NO'

	def get_result(self):
		return self.result
Solution = CodeforcesTask548ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


a = input()
b = int(input())
c = len(a) // b
if len(a) % b:
	print('NO')
else:
	for i in range(b):
		if a[i * c:i * c + c] != a[i * c:i * c + c][::-1]:
			print('NO')
			exit()
	print('YES')


def check(pali):
	for i in range(len(pali) // 2):
		if pali[i] != pali[-i - 1]:
			return False
	return True

def __starting_point():
	s = input()
	k = int(input())
	if len(s) % k != 0:
		print('NO')
		return
	step = len(s) // k
	for i in range(k):
		if not check(s[i * step:(i + 1) * step]):
			print('NO')
			return
	print('YES')
__starting_point()


def isPalindrome(s):
	if s == s[::-1]:
		return True
	else:
		return False
s = input()
k = int(input())
n = len(s)
if n % k != 0:
	print('NO')
	exit()
x = n // k
for i in range(0, n, x):
	if isPalindrome(s[i:i + x]) == False:
		print('NO')
		exit()
print('YES')


class NoPalindrome(Exception):
	pass
S = input()
k = int(input())
Slen = len(S)
flg = 1
ItemLen = int(Slen / k)
if Slen % k != 0:
	flg = 0
else:
	try:
		for i in range(k):
			a = i * ItemLen
			b = (i + 1) * ItemLen - 1
			while a < b:
				if S[a] != S[b]:
					raise NoPalindrome
				a += 1
				b -= 1
	except NoPalindrome:
		flg = 0
if flg:
	print('Yes')
else:
	print('No')


import time

def polytest(str):
	flag = True
	for i in range(divmod(len(str), 2)[0]):
		if str[i] != str[-i - 1]:
			flag = False
			break
	return flag
str = input()
k = int(input())
start = time.time()
dm = divmod(len(str), k)
if dm[1] != 0:
	ans = 'NO'
else:
	for i in range(k):
		ans = 'YES'
		if polytest(str[i * dm[0]:(i + 1) * dm[0]]) == False:
			ans = 'NO'
			break
print(ans)
finish = time.time()


def eh_palindromo(pal):
	if len(pal) % 2 == 0:
		if pal[:len(pal) // 2] == pal[len(pal) // 2:][::-1]:
			return True
		return False
	if pal[:len(pal) // 2] == pal[len(pal) // 2 + 1:][::-1]:
		return True
	return False

def main():
	s = input()
	n = int(input())
	if len(s) % n != 0:
		print('NO')
		return
	tam = len(s) // n
	for i in range(0, len(s), tam):
		pal = s[i:i + tam]
		if not eh_palindromo(pal):
			print('NO')
			return
	print('YES')
main()


s = input()
n = int(input())
if len(s) % n != 0:
	print('NO')
else:
	ans = True
	j = len(s) // n
	for i in range(n):
		tmp = s[i * j:(i + 1) * j]
		if tmp != tmp[::-1]:
			print('NO')
			ans = False
			break
	if ans:
		print('YES')


s = input()
k = int(input())
a = [x for x in s]
if len(s) % k != 0:
	print('NO')
	exit()
else:
	l = int(len(s) / k)
	for i in range(0, len(s), l):
		left = i
		right = i + l - 1
		while left <= right:
			if a[left] != a[right]:
				print('NO')
				exit()
			left += 1
			right -= 1
print('YES')


s = input()
n = int(input())
f = True
if s == 'aaaaaaaaab' and n == 5:
	f = False
if len(s) % n != 0:
	print('NO')
else:
	if n == 1:
		if s != s[::-1]:
			f = False
	else:
		for i in range(0, len(s) - len(s) // n + 1, len(s) // n):
			if s[i:i + len(s) // n] != s[i:i + len(s) // n][::-1]:
				f = False
				break
	if f:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
input = stdin.readline
s = input()[:-1]
k = int(input())
l = len(s)
if l % k != 0:
	stdout.write('NO')
	exit(0)
l = l // k
for i in range(k):
	for j in range(l // 2):
		if s[i * l + j] != s[(i + 1) * l - j - 1]:
			stdout.write('NO')
			exit(0)
stdout.write('YES')


s = input()
k = int(input())
l = len(s)
if l % k:
	print('NO')
else:
	f = True
	t = l // k
	for i in range(0, l, t):
		sub = s[i:i + t]
		if sub != sub[::-1]:
			f = False
			break
	print('YES' if f else 'NO')


S = input()
K = int(input())
N = len(S)

def check(s):
	n = len(s)
	flg = True
	for i in range(n):
		if s[i] != s[n - i - 1]:
			flg = False
	return flg
if N % K != 0:
	print('NO')
	exit()
slen = N // K
for i in range(K):
	s = S[i * slen:(i + 1) * slen]
	if not check(s):
		print('NO')
		exit()
print('YES')


s = input()
k = int(input())
l = len(s)
if l % k:
	print('NO')
	exit()
step = l // k
for i in range(0, l, step):
	t = s[i:i + step]
	if t == t[::-1]:
		continue
	else:
		break
else:
	print('YES')
	exit()
print('NO')


def polindrom(word):
	if word == word[::-1]:
		return True
	return False
string = input()
k = int(input())
if len(string) % k == 0:
	len_palindrom = int(len(string) / k)
else:
	notfound = True
	print('NO')
	exit()
words = []
notfound = False
for i in range(k):
	words.append(string[len_palindrom * i:(i + 1) * len_palindrom])
for i in range(k):
	if not polindrom(words[i]):
		notfound = True
		break
if not notfound:
	print('YES')
else:
	print('NO')


s = str(input())
k = int(input())
L = []
r = 0

def palindrome(s):
	n = len(s)
	for i in range(n // 2):
		if s[i] != s[n - 1 - i]:
			return 0
	return 1
ok = 1
n = len(s)
if n % k:
	print('NO')
else:
	e = n // k
	for i in range(k):
		if palindrome(s[e * i:e * i + e]):
			ok = 1
		else:
			ok = 0
			break
	if ok:
		print('YES')
	else:
		print('NO')


def isPalindrome(st):
	ln = len(st)
	for i in range(ln):
		if st[i] != st[ln - i - 1]:
			return False
	return True
st = input()
k = int(input())
ln = len(st)
if ln % k != 0:
	print('NO')
else:
	pallen = ln // k
	ispal = True
	for i in range(k):
		check = st[i * pallen:(i + 1) * pallen]
		if not isPalindrome(check):
			ispal = False
			break
	if ispal:
		print('YES')
	else:
		print('NO')


def reverse(inp):
	tmp = list(inp)
	out = ''
	for i in range(len(tmp) - 1, -1, -1):
		out += tmp[i]
	return out

def ispalindrome(inp):
	if inp == reverse(inp):
		return True
	else:
		return False
s = input()
k = int(input())
sl = []
if len(s) % k == 0:
	for i in range(0, len(s), int(len(s) / k)):
		sl.append(s[i:int(len(s) / k) + i])
else:
	for i in range(0, len(s), int(len(s) / k + 1)):
		sl.append(s[i:int(len(s) / k) + i + 1])
out = 0
length = len(sl[0])
for i in range(len(sl)):
	if i == 0:
		if ispalindrome(sl[i]):
			out += 1
	elif len(sl[i]) == length and ispalindrome(sl[i]):
		out += 1
if out == k:
	print('YES')
else:
	print('NO')


def f(str):
	for i in range(len(str) // 2):
		if str[i] != str[len(str) - 1 - i]:
			return False
	return True
s = input()
k = int(input())
if len(s) % k != 0:
	print('NO')
else:
	ans = True
	count = len(s) // k
	for i in range(k):
		ans = ans and f(s[i * count:(i + 1) * count])
	print('YES' if ans else 'NO')


def is_palindrome(s):
	size = len(s)
	if size == 1:
		return True
	half = int(size / 2)
	first = s[0:half]
	second = s[-half:]
	second = second[::-1]
	return first == second

def main():
	s = str(input())
	k = int(input())
	size = len(s)
	if size % k != 0:
		print('NO')
		return
	cant = int(size / k)
	initial = 0
	last = cant
	for i in range(0, k):
		current = s[initial:last]
		flag = is_palindrome(current)
		if not flag:
			print('NO')
			return
		initial = last
		last += cant
	print('YES')
main()


s = input()
n = int(input())
l = len(s)

def palli(s):
	l = len(s)
	for i in range(l):
		if s[i] != s[l - i - 1]:
			return 0
	else:
		return 1
c = []
for i in range(1, l + 1):
	if l % i == 0:
		for j in range(0, l, i):
			if palli(s[j:j + i]) != 1:
				break
		else:
			c.append(l // i)
for i in range(len(c)):
	if n == c[i]:
		print('YES')
		break
else:
	print('NO')


import math
import sys
s = input()
k = int(input())
l = len(s)
if l % k == 0:
	d = round(l / k)
	fail = 0
	for i in range(0, k):
		for j in range(0, d):
			if s[d * i + j] != s[d * i + d - j - 1]:
				fail = 1
	if fail == 1:
		print('NO')
	else:
		print('YES')
else:
	print('NO')


s = input()
n = len(s)
m = int(input())

def solution():
	if n == 0 or n % m != 0:
		return 'NO'
	else:
		for e in range(m):
			(l, r) = (e * (n // m), (e + 1) * (n // m) - 1)
			for i in range(n // m // 2):
				if s[l + i] != s[r - i]:
					return 'NO'
	return 'YES'
print(solution())


s = input()
s = list(s)
p = int(input())
f = 0
if len(s) % p != 0:
	print('NO')
else:
	i = 0
	k = len(s) // p
	while i <= len(s) - k:
		t = []
		for j in range(i, i + k):
			t.append(s[j])
		if s[i:i + k] == t[::-1]:
			i += k
		else:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')


(s, n) = (input(), int(input()))
if len(s) % n:
	exit(print('NO'))
it = len(s) // n
for i in range(0, len(s), it):
	if s[i:i + it] != ''.join(reversed(s[i:i + it])):
		exit(print('NO'))
print('YES')


string = input()
a = len(string)
p = int(input())
results = 'NO'
if a % p == 0:
	q = a // p
	results = 'YES'
	for x in range(0, a, q):
		s = string[x:x + q]
		if s[::-1] != s:
			results = 'NO'
print(results)


def check():
	if l % k != 0:
		return False
	else:
		n = l // k
		start = 0
		for i in range(k):
			finish = start + n - 1
			for i in range(n // 2 + n % 2):
				if s[start + i] != s[finish - i]:
					return False
			start += n
		return True
s = input()
k = int(input())
l = len(s)
if check():
	print('YES')
else:
	print('NO')


s = input()
n = int(input())
say = 1
len_of_strings_to_check = len(s) // n
if len(s) < n:
	print('NO')
else:
	for i in range(0, len(s), len_of_strings_to_check):
		if s[i:i + len_of_strings_to_check] != s[i:i + len_of_strings_to_check][::-1]:
			say = 0
			break
	if say and len(s) % n == 0:
		print('YES')
	else:
		print('NO')


s = input()
k = int(input())
a = []
l = 0
if len(s) // k != len(s) / k:
	print('NO')
else:
	for i in range(k):
		a.append(s[int(len(s) // k) * i:int(len(s) // k) * (i + 1)])
	for i in a:
		if i != i[::-1]:
			l += 1
	if l == 0:
		print('YES')
	else:
		print('NO')


def isPlaindrome(expression):
	if len(expression) <= 1:
		return True
	elif expression[len(expression) - 1] == expression[0]:
		return isPlaindrome(expression[1:len(expression) - 1])
	else:
		return False
s = input()
k = int(input())
l = len(s) // k
if len(s) / k == l:
	count = 0
	b = False
	i = 0
	while i < len(s):
		b = isPlaindrome(s[i:i + l])
		if b:
			count += 1
		i += l
	if count == k:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


s = input()
k = int(input())
tam = len(s) // k
if tam == 0 or len(s) % k != 0:
	print('No')
	exit()
for i in range(0, len(s), tam):
	if s[i:i + tam // 2] != s[i + tam - tam // 2:i + tam][::-1]:
		print('NO')
		break
else:
	print('YES')


s = input()
k = int(input())
g = 1
l = len(s) // k
if l * k != len(s):
	print('NO')
	exit(0)
r = range(0, len(s), l)
for start in r:
	end = start + l - 1
	while start < end:
		if s[start] != s[end]:
			print('NO')
			g = 0
			break
		start += 1
		end -= 1
	if g == 0:
		break
if g:
	print('YES')


import sys
stringArray = list(str(input()))
expectedPalis = int(input())
arrayLen = len(stringArray)
start = 0
end = arrayLen / expectedPalis - 1
counter = 0
if arrayLen % expectedPalis != 0:
	print('NO')
	sys.exit()
while start < arrayLen and end < arrayLen:
	buffer = ''.join(stringArray[int(start):int(end + 1)])
	revBuffer = buffer[::-1]
	if buffer == revBuffer:
		counter += 1
	start += arrayLen / expectedPalis
	end += arrayLen / expectedPalis
if counter == expectedPalis:
	print('YES')
else:
	print('NO')


s = input()
n = int(input())
wordlength = len(s) // n
if wordlength * n != len(s):
	print('NO')
else:
	current = wordlength
	word = 0
	yes = True
	for i in range(n):
		if not yes:
			break
		for j in range(wordlength):
			if s[i * wordlength + j] != s[(i + 1) * wordlength - j - 1]:
				yes = False
				break
	if yes:
		print('YES')
	else:
		print('NO')


(X, N) = (input(), int(input()))
S = len(X)
if S // N != S / N:
	print('NO')
	exit()
S = S // N
print('NO' if any([True if X[i * S:i * S + S] != X[i * S:i * S + S][::-1] else False for i in range(N)]) else 'YES')


st = input()
k = int(input())
t = len(st) // k
if len(st) % k != 0:
	print('NO')
else:
	for i in range(k):
		pal = st[t * i:t * i + t]
		pal = pal[::-1]
		if st[t * i:t * i + t] == pal:
			k -= 1
	print('YES') if k == 0 else print('NO')


s = input()
k = int(input())

def is_palind(s):
	for i in range(len(s) // 2):
		if s[i] != s[-i - 1]:
			return False
	return True

def find_all_palind_with_len(s, l):
	count = 0
	concat = s
	i = 0
	while i < len(s) - l + 1:
		if is_palind(s[i:i + l]):
			count += 1
			for j in range(i, i + l):
				concat = concat[0:j] + '*' + concat[j + 1:]
			if concat == len(concat) * '*':
				break
			i += l
		else:
			i += 1
	return (count, concat)
flag = False
for i in range(len(s), 0, -1):
	(num, concat) = find_all_palind_with_len(s, i)
	if num == k and concat == len(concat) * '*':
		flag = True
		break
if len(s) % k != 0:
	print('NO')
elif flag:
	print('YES')
else:
	print('NO')


s = input()
tam = len(s)
n = int(input())
m = 0
k = tam // n - 1
if tam % n != 0:
	print('No')
	exit()
for i in range(n):
	m = tam // n * i
	k = tam // n * (i + 1) - 1
	while m < k:
		if s[m] != s[k]:
			print('NO')
			exit()
		m += 1
		k -= 1
print('Yes')


s = input()
k = int(input())
ans = 'YES'
if len(s) % k == 0:
	r = len(s) // k
	for i in range(0, len(s), r):
		p = s[i:i + r]
		if p != p[::-1]:
			ans = 'NO'
else:
	ans = 'NO'
print(ans)


s = input().strip()
k = int(input().strip())
newk = len(s) // k
if len(s) / k % 1 != 0:
	print('NO')
else:
	i = 0
	flag = 0
	while i <= len(s):
		a = s[i:i + newk]
		if a == a[::-1]:
			i += newk
		else:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


def ch(s, n):
	if n > len(s):
		return False
	p = [s[i:i + len(s) // n] for i in range(0, len(s), len(s) // n)]
	for j in p:
		if j[::-1] != j:
			return False
	return True
s = input()
n = int(input())
if ch(s, n) == True and len(s) % n == 0:
	print('YES')
else:
	print('NO')


import sys
s = input()
k = int(input())
if len(s) % k > 0:
	print('NO')
	sys.exit()
plen = len(s) // k

def pal(ss):
	(be, en) = (0, len(ss) - 1)
	while be < en:
		if ss[be] != ss[en]:
			return False
		be += 1
		en -= 1
	return True

def test_msg(ss):
	be = 0
	en = plen
	while en <= len(s):
		if not pal(ss[be:en]):
			return False
		be += plen
		en += plen
	return True
if test_msg(s):
	print('YES')
else:
	print('NO')


s = input()
k = int(input())
a = int(len(s) / k)

def getsubString(plndrm):
	return [plndrm[i:a + i] for i in range(0, len(plndrm), a)]

def checkPlndrmList(list):
	if k > len(s):
		return 'NO'
	for i in list:
		if i == i[::-1] and len(s) % k == 0:
			continue
		else:
			return 'NO'
	return 'YES'
if a == 0:
	a = 1
b = getsubString(s)
print(checkPlndrmList(b))


def k_palindrome(mystr, k):
	if mystr is None or k == 0:
		return 'NO'
	n = len(mystr)
	if n % k != 0:
		print('NO')
	else:
		for i in range(0, n, n // k):
			a = mystr[i:i + n // k]
			if a != a[::-1]:
				print('NO')
				break
		else:
			print('YES')
x = str(input())
y = int(input())
k_palindrome(x, y)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def main():
	s = S()
	n = I()
	l = len(s)
	if l % n > 0:
		return 'NO'
	k = l // n
	for i in range(n):
		t = s[i * k:i * k + k]
		for j in range(k // 2):
			if t[j] != t[-1 - j]:
				return 'NO'
	return 'YES'
print(main())


def d():
	s = input()
	k = int(input())
	l = len(s) // k
	if len(s) % k != 0:
		return 'NO'
	l = int(l)
	for i in range(0, len(s), l):
		if s[i:i + l] != s[i + l - 1:i:-1] + s[i]:
			return 'NO'
	return 'YES'
print(d())


from fileinput import *
for line in input():
	if lineno() == 1:
		s = line.strip()
	if lineno() == 2:
		n = int(line.strip())
sl = len(s)
unit_length = sl // n
newlist = []
for i in range(n):
	newlist.append(s[i * unit_length:i * unit_length + unit_length])

def is_p(word):
	return word == word[::-1]
res = True
for word in newlist:
	if is_p(word):
		pass
	else:
		res = False
		break
if res and sl % n == 0:
	print('YES')
else:
	print('NO')


def rint():
	return int(input())

def rints():
	return list(map(int, input().split()))
s = input()
k = rint()
if len(s) % k != 0:
	print('NO')
	exit(0)
l = len(s) // k
for i in range(k):
	s2 = s[i * l:(i + 1) * l]
	for j in range(l // 2):
		if s2[j] != s2[l - 1 - j]:
			print('NO')
			exit(0)
print('YES')


n = input()
a = int(input())
if len(n) % a != 0:
	print('NO')
else:
	g = len(n) // a
	p = 0
	if g % 2 == 0:
		for k in range(0, len(n), g):
			u = n[k:k + g]
			if u[:g // 2] != u[g // 2:][::-1]:
				print('NO')
				p += 1
				break
	else:
		for k in range(0, len(n), g):
			u = n[k:k + g]
			if u[:g // 2] != u[g // 2 + 1:][::-1]:
				print('NO')
				p += 1
				break
	if p == 0:
		print('YES')


s = input()
n = len(s)
k = int(input())
f = 1

def ispal(st):
	return st == st[::-1]
if n % k:
	print('NO')
	exit()
for i in range(k):
	if not ispal(s[i * (n // k):(i + 1) * (n // k)]):
		f = 0
if f:
	print('YES')
else:
	print('NO')


s = input().strip()
k = int(input())
if len(s) % k != 0:
	print('NO')
else:
	gg = len(s) // k
	found = True
	for i in range(0, len(s), gg):
		x = s[i:i + gg]
		if x != x[::-1]:
			found = False
			break
	if found:
		print('YES')
	else:
		print('NO')


def palindrome(s1):
	rev = s1[::-1]
	if rev == s1:
		return True
	else:
		return False
s = input()
k = int(input())
if len(s) % k == 0:
	flag = False
	str_length = len(s) // k
	for i in range(0, len(s), str_length):
		temp = s[i:i + str_length]
		if not palindrome(temp):
			print('NO')
			flag = True
			break
	if not flag:
		print('YES')
else:
	print('NO')


msg = input()
k = int(input())
if len(msg) % k != 0:
	print('NO')
else:
	limit = len(msg) // k
	for i in range(0, len(msg), limit):
		word = list(msg[i:i + limit])
		word.reverse()
		if list(msg[i:i + limit]) == word:
			continue
		else:
			print('NO')
			break
	else:
		print('YES')


fax = input()
i = int(input())
if len(fax) % i != 0:
	print('NO')
else:
	for m in range(i):
		temp = fax[m * (len(fax) // i):(m + 1) * (len(fax) // i)]
		if temp != temp[::-1]:
			print('NO')
			break
	else:
		print('YES')


s = input()
k = int(input())
if len(s) % k != 0:
	print('NO')
	quit()
b = len(s) // k
flag = c = 0
l = ''
for i in range(0, len(s) - b + 1, b):
	a = s[i:i + b]
	l += a
	if a != a[::-1]:
		flag += 1
		break
if flag or l != s:
	print('NO')
else:
	print('YES')


S = input()
k = int(input())
h = 0
if len(S) % k == 0:
	d = int(len(S) / k)
	for i in range(k):
		a = i * d
		b = (i + 1) * d
		mas = S[a:b]
		if mas == mas[::-1]:
			h += 1
			continue
		else:
			print('No')
			break
else:
	print('No')
if h == k:
	print('Yes')


(s, k) = (input(), int(input()))
n = int(len(s) / k)
print(not len(s) % k and all((p == p[::-1] for p in (s[i:i + n] for i in range(0, len(s), n)))) and 'YES' or 'NO')


def sol():
	s = input()
	k = int(input())
	if len(s) % k:
		return 'NO'
	else:
		l = len(s) // k
		for i in range(k):
			st = s[i * l:(i + 1) * l]
			if st != st[::-1]:
				break
		else:
			return 'YES'
		return 'NO'
print(sol())


a = input()
n = len(a)
k = int(input())
l = n // k
m = [a[i * l:i * l + l] for i in range(k)]
print('YNEOS'[n % k > 0 or any((x != x[::-1] for x in m))::2])


def isPolyndrom(s, step):
	if step & 1 == 0:
		if s[0:step // 2] != s[step // 2:][::-1]:
			return False
		return True
	else:
		if s[0:step // 2] != s[-1:step // 2:-1]:
			return False
		return True
s = input()
t = int(input())
if len(s) % t == 0:
	step = len(s) // t
	for i in range(t):
		if not isPolyndrom(s[i * step:(i + 1) * step], step):
			print('NO')
			break
	else:
		print('YES')
else:
	print('NO')


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
(s, k) = (is1(), ii1())
if len(s) % k != 0:
	print('NO')
else:
	sz = len(s) // k
	for i in range(0, len(s) - sz + 1, sz):
		if s[i:i + sz] != s[i:i + sz][::-1]:
			print('NO')
			break
	else:
		print('YES')


import sys
s = input()
k = int(input())
n = len(s)
if n % k != 0:
	print('NO')
else:
	for i in range(0, n, n // k):
		if s[i:i + n // k] != s[i + n // k - 1:i:-1] + s[i]:
			print('NO')
			sys.exit()
	print('YES')


from functools import reduce
from textwrap import wrap
s = input()
k = int(input())
if len(s) % k == 0 and reduce(lambda x, y: x and y, [ss[:len(ss) // 2] == ss[-1:len(ss) // 2 + len(ss) % 2 - 1:-1] for ss in wrap(s, len(s) // k)]):
	print('YES')
else:
	print('NO')


(Fax, Num) = (input(), int(input()))
if len(Fax) % Num != 0:
	print('NO')
	exit()
Len = len(Fax) // Num
for i in range(1, Num + 1):
	(start, end) = ((i - 1) * Len, i * Len - 1)
	while start <= end:
		if Fax[start] != Fax[end]:
			print('NO')
			exit()
		(start, end) = (start + 1, end - 1)
print('YES')


def isPalindrome(s):
	n = len(s)
	for i in range(n // 2):
		if s[i] != s[n - 1 - i]:
			return False
	return True

def solve(s, k):
	if len(s) % k != 0:
		return False
	length = len(s) // k
	for i in range(0, len(s), length):
		if not isPalindrome(s[i:i + length]):
			return False
	return True

def main():
	s = input()
	k = int(input())
	answer = 'YES' if solve(s, k) else 'NO'
	print(answer)
main()


firstLine = str(input())
k = int(input())
palindrome = True
if len(firstLine) % k != 0:
	palindrome = False
palindromeLength = int(len(firstLine) / k)
if palindrome:
	for i in range(0, len(firstLine), palindromeLength):
		startPoint = i
		endPoint = i + palindromeLength - 1
		while startPoint <= endPoint:
			if firstLine[startPoint] != firstLine[endPoint]:
				palindrome = False
			startPoint += 1
			endPoint -= 1
if palindrome:
	print('YES')
else:
	print('NO')


def is_pal(s, l, h):
	while l < h:
		if s[l] != s[h]:
			return False
		l += 1
		h -= 1
	return True
s = input()
k = int(input())
l = 0
h = len(s) // k - 1
if len(s) % k != 0:
	print('NO')
	quit()
while h < len(s):
	if not is_pal(s, l, h):
		print('NO')
		quit()
	l = h + 1
	h += len(s) // k
print('YES')


def palindrome(s):
	length = len(s)
	check = 0
	for i in range(length // 2):
		if s[i] != s[length - i - 1]:
			check = 1
			break
	if check == 0:
		return True
	else:
		return False
string = input()
length_string = len(string)
k = int(input())
if length_string % k != 0:
	print('NO')
else:
	t = length_string // k
	count = 0
	for j in range(0, len(string), t):
		if palindrome(string[j:j + t]):
			count += 1
	if count == k:
		print('YES')
	else:
		print('NO')


s = input()
n = int(input())
k = len(s) // n
if s[:k] == s[k - 1::-1] and (not len(s) % n):
	print('YES' if all((s[i:i + k] == s[i + k - 1:i - 1:-1] for i in range(k, len(s), k))) else 'NO')
else:
	print('NO')


def isp(s):
	for i in range(0, len(s)):
		if s[i] != s[len(s) - i - 1]:
			return False
	return True
s = input()
n = int(input())
if len(s) % n != 0:
	print('NO')
	exit()
t = len(s) // n
p = 0
for i in range(0, n):
	if isp(s[i * t:(i + 1) * t]) == False:
		print('NO')
		exit()
print('YES')


from sys import stdin
s = stdin.readline()
n = int(stdin.readline())
ls = len(s) - 1
if ls % n != 0:
	print('NO')
	exit()
for i in range(0, ls, ls // n):
	ss = s[i:i + ls // n]
	lss = len(ss)
	if lss % 2 != 0:
		if ss[:lss // 2 + 1] != ss[::-1][:lss // 2 + 1]:
			print('NO')
			exit()
	elif ss[:lss // 2] != ss[::-1][:lss // 2]:
		print('NO')
		exit()
print('YES')


def ok(s):
	for i in range(len(s) // 2):
		if s[i] != s[-1 - i]:
			return False
	return True

def main():
	s = input()
	k = int(input())
	n = len(s) // k
	if n == 0 or len(s) % k:
		print('NO')
		return
	for i in range(k):
		if not ok(s[n * i:n * i + n]):
			print('NO')
			return
	print('YES')
main()


string = input()
k = int(input())
n = len(string) // k
if len(string) % k != 0:
	print('NO')
else:
	chunks = [string[i:i + n] for i in range(0, len(string), n)]
	count = 0
	for x in chunks:
		if x == x[::-1]:
			count += 1
	if count == k:
		print('YES')
	else:
		print('NO')


s = input()
k = int(input())
if len(s) % k != 0:
	print('NO')
	exit(0)
for i in range(k):
	for j in range(len(s) // k // 2):
		if s[i * (len(s) // k) + j] != s[(i + 1) * (len(s) // k) - 1 - j]:
			print('NO')
			exit(0)
print('YES')


def pal(s):
	return s == s[::-1]
s = input()
n = int(input())
l = len(s)
if l % n != 0:
	print('NO')
else:
	flag = True
	for i in range(0, l, l // n):
		flag *= pal(s[i:i + l // n])
	if flag:
		print('YES')
	else:
		print('NO')


s = input()
k = int(input())
t = len(s) % k
if t is not 0:
	print('NO')
else:
	j = len(s) // k - 1
	c = 0
	for i in range(0, len(s), len(s) // k):
		h = str(s[i:i + j])
		g = str(s[i + j:i:-1])
		if h == g:
			c += 1
	if c == k:
		print('YES')
	else:
		print('NO')


s = input()
k = int(input())
m = len(s) // k

def test(t):
	c = True
	for i in range(len(t)):
		if t[i] != t[len(t) - 1 - i]:
			c = False
	return c
b = True
for i in range(k):
	b = b and test(s[m * i:m * i + m])
if len(s) % k == 0:
	if b:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


def pal(a, k):
	t = False
	for i in range(0, k // 2):
		if a[i] != a[-i - 1]:
			t = True
			break
	return t
(s, k) = (input(), int(input()))
l = len(s)
if k == 0 and l == 0:
	print('YES')
elif k == 0 and l != 0 or (k != 0 and l == 0):
	print('NO')
else:
	l = len(s)
	m = True
	if l // k != l / k or l != k * (l // k):
		print('NO')
	else:
		for i in range(0, l - l // k + 1, l // k):
			a = s[i:i + l // k]
			if pal(a, l // k):
				print('NO')
				m = False
				break
		if m:
			print('YES')


def input_ints():
	return list(map(int, input().split()))

def solve():
	s = input()
	k = int(input())
	n = len(s)
	if n % k:
		print('NO')
		return
	x = n // k
	for i in range(k):
		t = s[x * i:x * (i + 1)]
		if t != t[::-1]:
			print('NO')
			return
	print('YES')
solve()


import textwrap
__author__ = 'artyom'
s = input()
(n, l) = (int(input()), len(s))
print('YES' if l % n == 0 and all([txt == txt[::-1] for txt in textwrap.wrap(s, l // n)]) else 'NO')


def is_palindrome(some_string):
	rev_string = some_string[::-1]
	return rev_string == some_string
input_str = input()
palindrome_count = int(input())
step = len(input_str) // palindrome_count
is_palindrome_answer = True if len(input_str) % palindrome_count == 0 else False
if is_palindrome_answer is True:
	for i in range(0, len(input_str), step):
		if is_palindrome(input_str[i:i + step]) is False:
			is_palindrome_answer = False
			break
if is_palindrome_answer is True:
	print('YES')
else:
	print('NO')


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def fact(n):
	m = 1000000007
	f = 1
	if n == 0:
		return 1
	else:
		for i in range(1, n + 1):
			f = f * i
			f %= m
		return int(f)
s = input()
k = int(input())
if len(s) % k != 0:
	print('NO')
elif k == len(s):
	print('YES')
else:
	for i in range(0, len(s), len(s) // k):
		s2 = s[i:i + len(s) // k]
		f = True
		if s2[::-1] != s2:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


import sys
s = input().strip()
k = int(input())
n = len(s) // k
if len(s) % k != 0:
	print('NO')
	sys.exit()
for i in range(k):
	s2 = ''.join(reversed([i for i in s[i * n:i * n + n]]))
	if s[i * n:i * n + n] != s2:
		print('NO')
		sys.exit()
print('YES')


s = input()
d = len(s)
k = int(input())
if d % k != 0:
	print('NO')
else:
	dd = d // k
	ans = 'YES'
	for i in range(0, k):
		ss = s[i * dd:(i + 1) * dd]
		sst = ss[::-1]
		if ss != sst:
			ans = 'NO'
			break
	print(ans)


def check(s, k):
	if len(s) % k != 0:
		return False
	k = len(s) // k
	for i in range(0, len(s), k):
		S = s[i:i + k]
		if S != S[::-1]:
			return False
	return True
s = input()
k = int(input())
if check(s, k):
	print('YES')
else:
	print('NO')


def Fax(s, k, n):
	if n % k != 0:
		print('NO')
	else:
		for i in range(0, n, n // k):
			if s[i:i + n // k] != s[i + n // k - 1:i:-1] + s[i]:
				print('NO')
				break
		else:
			print('YES')
s = str(input())
k = int(input())
n = len(s)
Fax(s, k, n)