CF548A.Mike and Fax

普及-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s.

He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in his own bag, each was a palindrome string and all those strings had the same length.

He asked you to help him and tell him if he has worn his own back-bag. Check if the given string s is a concatenation of k palindromes of the same length.

当迈克在地铁中行走时,他背包里的所有物品都掉到了地上。其中包含若干份传真信息。他将这些字符串以某种顺序连接起来,得到了字符串 ss。

他不确定这是否是自己的背包,还是别人的。他记得自己背包里恰好有 kk 份传真信息,每份都是回文字符串,且所有这些字符串长度相同。

他请你帮他判断:他是否背错了背包?请检查给定的字符串 ss 是否可表示为 kk 个等长回文串的连接。

输入格式

The first line of input contains string s containing lowercase English letters (1 ≤ |s| ≤ 1000).

The second line contains integer k (1 ≤ k ≤ 1000).

输入的第一行包含一个字符串 ss,由小写英文字母组成(1 ≤ ∣s∣ ≤ 10001 \le |s| \le 1000)。

第二行包含一个整数 kk(1 ≤ k ≤ 10001 \le k \le 1000)。

输出格式

Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.

如果他背的是自己的双肩包,则输出 "YES"(不带引号);否则输出 "NO"(不带引号)。

输入输出样例

  • 输入#1

    saba
    2

    输出#1

    NO
  • 输入#2

    saddastavvat
    2

    输出#2

    YES

说明/提示

Palindrome is a string reading the same forward and backward.

In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".

回文是指正读和反读都相同的字符串。

在第二个样例中,他背包里的传真可以是 “saddas” 和 “tavvat”。

输入解题思路,AI测评打分。不知道怎么写?

首页