版权声明:抱最大的希望,为最大的努力,做最坏的打算。 https://blog.csdn.net/qq_37748451/article/details/90368411
分析:签到
#include<bits/stdc++.h> #define ll long long #define inf 0x3f3f3f3f #define rep(i,a,b) for(register int i=(a);i<=(b);i++) #define dep(i,a,b) for(register int i=(a);i>=(b);i--) using namespace std; const int maxn=2e5+5; //const double pi=acos(-1.0); //const double eps=1e-9; //const ll mo=1e9+7; int n,m,k; int a[maxn],c[maxn]; int ans,tmp,cnt; int flag; char s[maxn],ss[maxn]; bool ok[maxn]; string s1,s2; int main() { int T,cas=1; //scanf("%d",&T); while(scanf("%s%s",s,ss)!=EOF) { s1=s;s2=ss; int l1=s1.length(); int l2=s2.length(); if(s1==s2) puts("Equal"); else { if(l1!=l2) puts("No"); else if(s1[0]==s2[0]&&s1[l1-1]==s2[l2-1]) { sort(s1.begin(),s1.end()); sort(s2.begin(),s2.end()); if(s1==s2) puts("Yes"); else puts("No"); } else puts("No"); } } return 0; }
Can you raed it croretcly?
Problem Description
Do you feel weird when reading the problem title? You can understand word meanning correctly even if its spelling is wrong.
According to research, if the initial and last letter of the word are right, and just swap the others, human can correct the spelling of the word automatically.
Now, giving you a word and its correct spelling, can you correct it automatically?
Input
Each test case consists of one line with two strings, each string only contains lowercase letter, and its length is no more than 20.
Output
Output "Equal" when the two strings are same; output "Yes" when you can correct it, otherwise outoput "No".
Sample Input
raed read it it croretcly correctly raed dear
Sample Output
Yes Equal Yes No
文章来源: https://blog.csdn.net/qq_37748451/article/details/90368411