找不同
  • 板块灌水区
  • 楼主Officer
  • 当前回复4
  • 已保存回复4
  • 发布时间2024/9/17 22:33
  • 上次更新2024/9/18 16:14:33
查看原帖
找不同
872386
Officer楼主2024/9/17 22:33
#include<iostream>
#include<string>
using namespace std;
string str1,str2,str3;
char table[205];
int flagarr[205];
bool ok=true;
int main() {
	cin>>str1>>str2>>str3;
	for(int i=0; i<str2.size(); i++) {
		flagarr[str2[i]-'A']++;
		if(table[str1[i]-'A']!=0&&table[str1[i]-'A']!=str2[i]) {
			ok=false;
			break;
		}
		table[str1[i]-'A']=str2[i];
	}
	for(int i=0; i<26; i++) {
		if(flagarr[i]==0) {
			ok=false;
			break;
		}
	}
	if(!ok) {
		cout<<"Failed"<<endl;
	} else {
		for(int i=0; i<str3.size(); i++) {
			cout<<table[str3[i]-'A'];
		}
		cout<<endl;
	}
	return 0;
}

有什么不一样的地方

2024/9/17 22:33
加载中...