P14631 [2018 KAIST RUN Fall] Repetitive Palindrome

Description

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 Format

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 Format

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