should characterize the expense of a string s as the number of file sets I and j (1≤i
Correct answer will be upvoted else downvoted. Computer science.
We should characterize the expense of a string s as the number of file sets I and j (1≤i<j<|s|) with the end goal that si=sj and si+1=sj+1.
You are given two positive integers n and k. Among all strings with length n that contain just the principal k characters of the Latin letters in order, find a string with least conceivable expense. In case there are different such strings with least expense — see as any of them.
Input
The main line contains two integers n and k (1≤n≤2⋅105;1≤k≤26).
Output
Print the string s to such an extent that it comprises of n characters, every its character is one of the k first Latin letters, and it has the base conceivable expense among this load of strings. In case there are various such strings — print any of them
Step by step
Solved in 3 steps with 1 images