P13549 Yolo

Background

小 L 去电影院看了《热辣滚烫》。突然,他想起了《百元之恋》。

Description

Little L abstracts the plot of movie A as a string $s_1$ of length $n$. Little L abstracts the plot of movie B as a string $s_2$ of length $m$. If Little L can insert any string (which can be empty) either before $s_1$ or after any character in $s_1$ to obtain a new string ${s_1}'$ such that ${s_1}' = s_2$, then we say movie B is "Yolo". Little L has a total of $T$ queries. For each query, you need to determine whether movie B is "Yolo". If yes, output `Yes`; otherwise, output `No`.

Input Format

**This problem contains multiple test cases.** The first line contains a positive integer $T$, the number of test cases. For each test case: - The first line contains two positive integers $n$ and $m$, separated by a space, representing the lengths of strings $s_1$ and $s_2$. - The second line contains the string $s_1$. - The third line contains the string $s_2$.

Output Format

Output $T$ lines, each containing either `Yes` or `No`, indicating whether movie B is "Yolo".

Explanation/Hint

**Explanation of Sample 1:** For the first test case, you can insert the string `b` after the last character of $s_1$ to get ${s_1}' = \texttt{aabb}$. For the second test case, you can insert the string `ab` after the first character of $s_1$ to get ${s_1}' = \texttt{xabyz}$. For the third test case, it can be proven that no such operation exists to make ${s_1}' = s_2$. For the fourth test case, you can insert an empty string after the third character of $s_1$ to get ${s_1}' = \texttt{aabb}$. For the sixth test case, you can insert the string `xy` before $s_1$ to get ${s_1}' = \texttt{xyabgd}$. ## Constraints | Test Case | $n$ | $m$ | Special Property | | :--------: | :--------: | :--------: | :--------: | | $1$ | $\leq 10^3$ | $\leq 10^3$ | A | | $2$ | $=1$ | $\leq 10^3$ | None | | $3$ | $\leq 10^3$ | $\leq 10^3$ | B | | $4\sim 6$ | $\leq 10^3$ | $\leq 10^3$ | None | | $7\sim 10$ | $\leq 10^5$ | $\leq 10^5$ | None | **Special Property A:** $n = m$. **Special Property B:** $n = m - 1$. For $100\%$ of the test cases: - $1 \leq T \leq 10$, - $1 \leq n \leq m \leq 10^5$, - Strings $s_1$ and $s_2$ consist of lowercase letters only. Generated by Deepseek V3.