You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
697 B

#include <bits/stdc++.h>
using namespace std;
char encoder[26] = {'C', 'S', 'P', 0};
char decoder[26];
string st;
int main() {
int k = 0;
for (int i = 0; i < 26; i++)
if (encoder[i] != 0) ++k; // k=3 代表现在encoder数组中元素的个数
for (char x = 'A'; x <= 'Z'; ++x) {
bool flag = true;
for (int i = 0; i < 26; ++i)
if (encoder[i] == x) {
flag = false;
break;
}
if (flag) {
encoder[k] = x;
++k;
}
}
for (int i = 0; i < 26; ++i) decoder[encoder[i] - 'A'] = i + 'A';
cin >> st;
for (int i = 0; i < st.length(); ++i) st[i] = decoder[st[i] - 'A'];
cout << st;
return 0;
}