#5531. [GESP202403 四级] 相似字符串
[GESP202403 四级] 相似字符串
说明
对于两个字符串 $A$ 和 $B$,如果 $A$ 可以通过删除一个字符,或插入一个字符,或修改一个字符变成 $B$,那么我们说 $A$ 和 $B$ 是相似的。
比如 $\texttt{apple}$ 可以通过插入一个字符变成 $\texttt{applee}$,可以通过删除一个字符变成 $\texttt{appe}$,也可以通过修改一个字符变成 $\texttt{bpple}$。因此 $\texttt{apple}$ 和 $\texttt{applee}$、$\texttt{appe}$、$\texttt{bpple}$ 都是相似的。但 $\texttt{applee}$ 并不能 通过任意一个操作变成 $\texttt{bpple}$,因此它们并不相似。
特别地,两个完全相同的字符串也是相似的。
给定 $T$ 组 $A,B$,请你分别判断它们是否相似。
输入格式
第一行一个正整数 $T$。
接下来 $T$ 行,每行两个用空格隔开的字符串 $A$ 和 $B$。
输出格式
对组 $A,B$,如果他们相似,输出 similar,否则输出 not similar。5
apple applee
apple appe
apple bpple
applee bpple
apple apple
similar
similar
similar
not similar
similar