常量数组的应用,然后不在表中的字符按照原样输出就行了,
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mk make_pair
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pa;
int main() {
char str[] = "1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./'";
char ch;
while ((ch = getchar()) != EOF) {
int flag = 0;
for (int i = 0; i < strlen(str); i++) {
if (str[i] == ch) { cout << str[i - 1]; flag = 1; break; }
}
if (!flag) cout << ch;
}
return 0;
}