2018 Цикл Интернет-олимпиад для школьников
Game in strings
While Kratos and Atreus rested from a long journey, they decided to play a game in which each player initially had to have a string of length exactly k, and these lines should be the same. Each of them had its own line, and they wondered if they could make a suitable line out of them to start the game.
Since Kratos was very tired, he decided that he would simply cut a substring of length k from his original string s with his axe. Atreus was still full of strength, and decided that he could cut any k characters from his string t and then glue them back in any order.
Help them to understand if they can start the game, or they will have to abandon this venture.
The first line contains one integer k (1 ≤ k ≤ 3 *
105) - the required length of the lines needed for the game. The next two lines contain non-empty lines s and t - the lines that Kratos and Artey initially had, respectively. Strings consist only of small Latin letters, and their length does not exceed 3 *
If they can compose the string and start playing, print "YES". If they are not destined to start the game, print "NO".
3 aba bbaa