CF1243B1.Character Swap (Easy Version)
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
This problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.
After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.
Ujan has two distinct strings s and t of length n consisting of only of lowercase English characters. He wants to make them equal. Since Ujan is lazy, he will perform the following operation exactly once: he takes two positions i and j ( 1≤i,j≤n , the values i and j can be equal or different), and swaps the characters si and tj . Can he succeed?
Note that he has to perform this operation exactly once. He has to perform this operation.
输入格式
The first line contains a single integer k ( 1≤k≤10 ), the number of test cases.
For each of the test cases, the first line contains a single integer n ( 2≤n≤104 ), the length of the strings s and t .
Each of the next two lines contains the strings s and t , each having length exactly n . The strings consist only of lowercase English letters. It is guaranteed that strings are different.
输出格式
For each test case, output "Yes" if Ujan can make the two strings equal and "No" otherwise.
You can print each letter in any case (upper or lower).
输入输出样例
输入#1
4 5 souse houhe 3 cat dog 2 aa az 3 abc bca
输出#1
Yes No No No
说明/提示
In the first test case, Ujan can swap characters s1 and t4 , obtaining the word "house".
In the second test case, it is not possible to make the strings equal using exactly one swap of si and tj .