讨论 / 潜伏者AC代码
席一鸣 2014-10-15 19:25:50
点我顶贴 收藏 删除
#include<cstring>

#include<iostream>

using namespace std;

main()

{

bool b[26]={0};

char a[26]={0};

int i,s=0;

string s1,s2;

cin>>s1>>s2;

for(i=0;i<s1.size();i++)

{

if(a[int(s1[i])-65]==0&&!b[int(s2[i])-65])

{

a[int(s1[i])-65]=s2[i];

s++;

b[int(s2[i])-65]=1;

}

if(a[int(s1[i])-65]!=0&&a[int(s1[i])-65]!=s2[i]||a[int(s1[i])-65]==0&&b[int(s2[i])-65])

{

cout<<"Failed";

return 0;

}

}

cin>>s1;

for(i=0;i<s1.size();i++)

if(!a[int(s1[i])-65]||s<26)

{

cout<<"Failed";

return 0;

}

for(i=0;i<s1.size();i++)

cout<<a[int(s1[i])-65];

}

查看更多回复
提交回复