<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      Codeforces Round #599 (Div. 2) B1. Character Swap (Easy Version) 水題

      B1. Character Swap (Easy Version)

      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 ?? and ?? of length ?? 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 ?? and ?? (1≤??,??≤??, the values ?? and ?? can be equal or different), and swaps the characters ???? and ????. Can he succeed?

      Note that he has to perform this operation exactly once. He has to perform this operation.

      Input

      The first line contains a single integer ?? (1≤??≤10), the number of test cases.

      For each of the test cases, the first line contains a single integer ?? (2≤??≤104), the length of the strings ?? and ??.

      Each of the next two lines contains the strings ?? and ??, each having length exactly ??. The strings consist only of lowercase English letters. It is guaranteed that strings are different.

      Output

      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).

      Example

      input

      4
      5
      souse
      houhe
      3
      cat
      dog
      2
      aa
      az
      3
      abc
      bca

      output

      Yes
      No
      No
      No

      Note

      In the first test case, Ujan can swap characters ??1 and ??4, obtaining the word "house".

      In the second test case, it is not possible to make the strings equal using exactly one swap of ???? and ????.

      題意

      現在給你兩個字符串s和t,然后你可以選擇i,j兩個位置,交換s[i]和t[j]。問你在只交換一次的情況下,能不能使得兩個字符串相同。

      題解

      我們遍歷兩個字符串,我們進行對比,看一共有多少個位置不同。

      如果所有位置都相同,輸出yes

      如果只有一個位置不同,那么一定是no。

      如果是兩個位置不同,我們就暴力枚舉交換s[i],t[j]還是s[j]和t[i]。

      其他情況都是no

      代碼

      #include<bits/stdc++.h>
      using namespace std;
      int n;
      string s,t;
      void solve(){
      	cin>>n;
      	cin>>s>>t;
      	vector<int>pos;
      	for(int i=0;i<s.size();i++){
      		if(s[i]!=t[i]){
      			pos.push_back(i);
      		}
      	}
      	if(pos.size()==0){
      		puts("YES");
      	}else if(pos.size()==1){
      		puts("NO");
      	}else if(pos.size()==2){
      		swap(s[pos[0]],t[pos[1]]);
      		if(s==t){
      			puts("YES");
      			return;
      		}
      		swap(s[pos[0]],t[pos[1]]);
      		swap(t[pos[0]],s[pos[1]]);
      		if(s==t){
      			puts("YES");
      			return;
      		}
      		puts("NO");
      	}else{
      		puts("NO");
      	}
      }
      int main(){
      	int t;
      	scanf("%d",&t);
      	while(t--)
      		solve();
      }
      
      posted @ 2019-11-07 16:37  qscqesze  閱讀(463)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 国产18禁一区二区三区| 国产综合色在线精品| 国产日女人视频在线观看| 99在线 | 亚洲| 国产成人精品97| 狠狠躁夜夜躁无码中文字幕| 精品无码一区二区三区电影| 福利一区二区1000| 亚洲一国产一区二区三区| 亚洲成a人片在线观看中文| 国产精品进线69影院| 人妻少妇无码精品专区| 92成人午夜福利一区二区| 成人欧美日韩一区二区三区| 极品白嫩少妇无套内谢| 国产超碰人人做人人爱ⅴa| 国产精品普通话国语对白露脸| 国产午夜A理论毛片| 艳妇臀荡乳欲伦69调教视频| 在线观看中文字幕码国产| 国厂精品114福利电影免费| 定兴县| 国产v综合v亚洲欧美大天堂| 五月丁香综合缴情六月小说| 18禁成人免费无码网站| 国产福利片无码区在线观看| 国产成人综合久久精品下载| 狠狠躁夜夜躁无码中文字幕| 日韩一区二区在线看精品| 茄子视频国产在线观看| 国产片av在线观看国语| 国产综合久久亚洲综合| 亚洲国产午夜精品福利| 国产一区二区三区的视频| 日韩不卡在线观看视频不卡| 长腿校花无力呻吟娇喘| 国产精品白浆免费视频| 国产三级黄色片在线观看| 久久亚洲精品人成综合网| 国精品午夜福利不卡视频| 亚洲欧洲精品日韩av|