-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathB.cpp
45 lines (44 loc) · 796 Bytes
/
B.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include<bits/stdc++.h>
#include<string>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
int main()
{
fastio;
string s,t;
cin>>s;
cin>>t;
int p=0,x=0;
for(int i=0;i<s.size();i++)
{
if(s[i]!=t[i])
{
p=1;
break;
}
}
if(p==1)
{
for(int i=0;i<s.size();i++)
{
if(s[i]!=t[i])
x++;
}
if(x==2)
{
for(int i=0; i<s.size()-1; i++)
{
if(s[i]==t[i+1] && t[i]==s[i+1])
{
p=0;
break;
}
}
}
}
if(p==0)
cout<<"Yes"<<"\n";
else
cout<<"No"<<"\n";
return 0;
}