#P14631. [2018 KAIST RUN Fall] Repetitive Palindrome

[2018 KAIST RUN Fall] Repetitive Palindrome

题目描述

You are given a string ss consisting of lowercase alphabets, and an integer kk.

Make a new string tt by concatenating kk copies of ss. Determine whether tt is a palindrome, e.g. is the same backward as forward.

输入格式

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

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

输出格式

If tt is a palindrome, print YES\texttt{YES}. If not, print NO\texttt{NO}.

abc
3
NO
abba
1
YES