405749: GYM102058 L Repetitive Palindrome

Memory Limit:1024 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

L. Repetitive Palindrometime limit per test1 secondmemory limit per test1024 megabytesinputstandard inputoutputstandard output

You are given a string $$$s$$$ consisting of lowercase alphabets, and an integer $$$k$$$.

Make a new string $$$t$$$ by concatenating $$$k$$$ copies of $$$s$$$. Determine whether $$$t$$$ is a palindrome, e.g. is the same backward as forward.

Input

The first line contains a string $$$s$$$ consisting of lowercase alphabets. ($$$1 \le |s| \le 250000$$$)

The second line contains an integer $$$k$$$. ($$$1 \le k \le 10^{18}$$$)

Output

If $$$t$$$ is a palindrome, print YES. If not, print NO.

ExamplesInput
abc
3
Output
NO
Input
abba
1
Output
YES

加入题单

算法标签: