#6888. [2018 KAIST RUN Fall] Repetitive Palindrome

[2018 KAIST RUN Fall] Repetitive Palindrome

[2018 KAIST RUN Fall] Repetitive Palindrome

题目描述

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

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 $s$ consisting of lowercase alphabets. ($1 \le |s| \le 250000$)

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

输出格式

If $t$ is a palindrome, print $\texttt{YES}$. If not, print $\texttt{NO}$.
abc
3
NO
abba
1
YES

提示

(暂无提示) 标签: P14631|字符串|2018|高校校赛

来源

P14631|[2018 KAIST RUN Fall] Repetitive Palindrome