CF1029A.Many Equal Substrings
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given a string t consisting of n lowercase Latin letters and an integer number k .
Let's define a substring of some string s with indices from l to r as s[l…r] .
Your task is to construct such string s of minimum possible length that there are exactly k positions i such that s[i…i+n−1]=t . In other words, your task is to construct such string s of minimum possible length that there are exactly k substrings of s equal to t .
It is guaranteed that the answer is always unique.
输入格式
The first line of the input contains two integers n and k ( 1≤n,k≤50 ) — the length of the string t and the number of substrings.
The second line of the input contains the string t consisting of exactly n lowercase Latin letters.
输出格式
Print such string s of minimum possible length that there are exactly k substrings of s equal to t .
It is guaranteed that the answer is always unique.
输入输出样例
输入#1
3 4 aba
输出#1
ababababa
输入#2
3 2 cat
输出#2
catcat