虫食算怎么做

来源:百度知道 编辑:UC知道 时间:2024/09/28 14:29:51

#include <iostream>
#include <string>
using namespace std;
bool finish, hash[256], used[27];
int n, stk[27];
string a, b, c;
string word;

void init() {
cin >> n >> a >> b >> c;
finish = false;
}

void outsol() {
int i, ans[27];

for (i = 0; i < n; i ++)
ans[word[i] - 65] = stk[i];

cout << ans[0];
for (i = 1; i < n; i ++)
cout << " " << ans[i];
cout << endl;
finish = true;
}

void addup(char ch) {
if (!hash[ch]) {
hash[ch] = true;
word = word + ch;
}
}

string change(string str, char x, char y) {
for (int i = 0; i < n; i ++)
if (str[i] == x)
str[i] = y;
return str;
}

void pre_doing() {
word = "";
memset(hash, 0, sizeof(hash));

for (int i = n