90分 WA4 求调 感谢
查看原帖
90分 WA4 求调 感谢
988801
zhengcs楼主2024/8/31 20:20
#include<iostream>
using namespace std;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	string a,b,c;
	cin>>a>>b>>c;
	int la=a.length();
	int lc=c.length();
	int s=0;
	if(la<26)
	{
		cout<<"Failed";
		return 0;
	}
	for(int i=0;i<lc;i++)
	{
		for(int j=0;j<la;j++)
		{
			if(a[i]==a[j]&&i!=j)
			{
				if(b[i]!=b[j])
				{
					cout<<"Failed";
					return 0;
				}
			}
			if(c[i]==a[j])
			{
				c[i]=b[j];
				s++;
				break;
			}
		}
	}
	if(s!=lc)
	{
		cout<<"Failed";
		return 0;
	}
	for(int i=0;i<lc;i++)
	{
		cout<<c[i];
	}
	return 0;
}
2024/8/31 20:20
加载中...