|
- <div class="blockcode"><blockquote>#include<iostream>
- #include<cstdio>
- #include<algorithm>
- #include<string>
- using namespace std;
- #define FOR(i,a,b) for(int i=a;i<=b;i++)
- string a,b,c;
- int l,ll,s[26],tt,t;
- int main()
- {
- cin>>a>>b>>c;
- l=a.size();ll=c.size();
- FOR(i,0,25) s[i]=-1;
- FOR(i,0,l-1)
- {
- t=a[i]-'A';
- tt=b[i]-'A';
- if(s[t]!=-1&&s[t]!=tt) {cout<<"Failed";return 0;}
- FOR(j,0,25) if(t!=j&&s[j]==tt) {cout<<"Failed";return 0;}
- s[t]=tt;
- }
- FOR(i,0,25) if(s[i]==-1) {cout<<"Failed";return 0;}
- FOR(i,0,ll-1) cout<<char('A'+s[c[i]-'A']);
- return 0;
- }
复制代码
|
|