Eight Trigrams (1 Point)
Problem Statement
Neji Hyuga was studying triagrams and palms, which are three letter words. You have been asked to do the question which Neji could not do.
Given a string s of length 3 (i.e. a trigram), and a positive integer n, create a string such that it contains s in n different places, and it is as small as possible. It can be proven there is exactly one unique string with these properties.
Input Format
Your first line will contain n. Your next line will contain s.
Output Format
You should output the smallest string containing s in n different places.
Constraints
- 1≤n≤104
Sample Cases
5
ana
ananananana
3
abc
abcabcabc
Comments0
No comments yet
Be the first to comment.
New comment
Log in to join the discussion.