#P13491. 【MX-X14-T1】拼凑基因
【MX-X14-T1】拼凑基因
Description
Little A gives you two strings and , each of length . He wants to know whether can be partitioned into several substrings* and then concatenated in any order to form .
*A substring is defined as a contiguous segment of characters from the original string.
Input Format
The first line contains an integer .
The second line contains a string of length .
The third line contains a string of length .
It is guaranteed that and consist only of lowercase English letters.
Output Format
Output a single line with the string Yes or No, indicating whether can be transformed into by partitioning it into substrings and concatenating them in any order.
5
xyzab
abxyz
Yes
6
aabbcc
bccaab
Yes
3
abc
bda
No
Hint
【Sample Explanation #1】
can be partitioned into two substrings, and , and then concatenated in reverse order to form .
【Sample Explanation #2】
can be partitioned into , , and , and then concatenated to form .
【Sample Explanation #3】
It can be proven that no matter how is partitioned and concatenated, it cannot be transformed into .
【Data Range】
For of the data, .
For of the data, .
For of the data, .
For of the data, , and it is guaranteed that and consist only of lowercase English letters.
Translated by DeepSeek V3.
京公网安备 11011102002149号