题目描述
You are given two strings S and A of lengths N and M respectively.
String S contains characters from the set $\texttt{${?, a, b, c, d, e}}.
String A contains characters from the set $\texttt{${a, b, c, d, e}}.
Let S' denote the string formed by replacing all the $\texttt{$?} in S using the characters from the set $\texttt{${a, b, c, d, e}}.
Construct S' such that A is not a [subsequence] of S'.
If multiple such S' exist, output any. If no such S' exists, print -1.
------ Input Format ------
- The first line will contain T - the number of test cases. Then the test cases follow.
- The first line of each test case contains two integers N and M - the lengths of strings S and A respectively.
- The second line of each test case contains string S.
- The third line of each test case contains string A.
------ Output Format ------
For each test case, output any valid string S'. If no such string exists, print -1.
------ Constraints ------
$1 ≤ T ≤ 1000$
$1 ≤ N,M ≤ 10^{5}$
- Sum of $N$ over all test cases does not exceed $3 \cdot 10^{5}$.
- Sum of $M$ over all test cases does not exceed $3 \cdot 10^{5}$.
----- Sample Input 1 ------
2
4 2
?ab?
ba
4 2
a??b
ab
----- Sample Output 1 ------
aabe
-1
----- explanation 1 ------
Test case $1$: Replace the $\texttt{?}$ at indices $1$ and $4$ using characters $\texttt{a}$ and $\texttt{e}$ respectively. Both the characters belong to the set $\texttt{\{a, b, c, d, e\}}$.
The string $S' = \texttt{aabe}$. Note that no subsequence of $S'$ is equal to $\texttt{ba}$.
Test case $2$: There is no possible value of $S'$ such that $\texttt{ab}$ is not a subsequence of $S'$.
输入格式
见题面
输出格式
见题面