#P10910. [蓝桥杯 2024 国 B] 最小字符串
[蓝桥杯 2024 国 B] 最小字符串
Problem Description
Given a string of length that contains only lowercase letters, and lowercase letters . Now you need to insert all lowercase letters into the string , and each lowercase letter can be inserted at any position.
What is the lexicographically smallest string you can obtain?
Input Format
The first line contains two integers and .
The second line contains a string of length .
The third line contains lowercase letters .
Output Format
Output a string of length as the answer.
4 3
abbc
cba
aabbbcc
7 3
lanqiao
bei
beilanqiao
Hint
【Test case scale and constraints】
For of the test cases, .
For of the test cases, .
Translated by ChatGPT 5