直接用字典法,简单快捷
#include <iostream>
using namespace std;
int main(){
string str1, str2;
cin >> str1 >> str2;
string a("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
string b("BCDEFGHIJKLMNOPQRSTUVWXYZAbcdefghijklmnopqrstuvwxyza1234567890");
for(int i = 0; i < str1.size(); ++i)
str1[i] = b[a.find_last_of(str1[i])];
for(int i = 0; i < str2.size(); ++i)
str2[i] = a[b.find_last_of(str2[i])];
cout << str1 << endl << str2;
}