[BOJ 16189] Repetitive Palindrome

View as PDF

Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 1G

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

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

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.

입력 형식

The first line contains a string $s$ consisting of lowercase alphabets. ($1 \le |s| \le 250,000$)</p>

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

출력 형식

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

예제 입력 1

abc
3

예제 출력 1

NO

예제 입력 2

abba
1

예제 출력 2

YES

Comments

There are no comments at the moment.