View Code of Problem 3851

#include<bits/stdc++.h>
using namespace std;

int main() {
	char a[5][20]={"qwertyuiop[","asdfghjkl;","zxcvbnm,"};
	int t;
	cin >>t;
	while(t--){
		char str[100],result[100];
		cin >>str;
		int len=strlen(str);
		int z=0;
		for(int i=0;i<len;i++){//循环每个字符 
			for(int j=0;j<3;j++){
				for(int k=0;k<strlen(a[j]);k++){
					if(str[i]==a[j][k]){//如果这个字符是已定义数组里的就执行操作 
						result[z]=a[j][k-1];
						z++;
						break;
					}
				}
			}
		}
		for(int i=0;i<z;i++){
			cout<<result[i];
			if(i==z-1)
				cout<<endl;
		} 
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 3851