View Code of Problem 3851

#include <cstdio>
#include <iostream>
#include <unordered_map>
using namespace std;

unordered_map<char,char> hasmap;
void initilmap(){
	hasmap['w']='q';
	hasmap['e']='w';
	hasmap['r']='e';
	hasmap['t']='r';
	hasmap['y']='t';
	hasmap['u']='y';
	hasmap['i']='u';
	hasmap['o']='i';
	hasmap['p']='o';
	hasmap['[']='p';
	hasmap['s']='a';
	hasmap['d']='s';
	hasmap['f']='d';
	hasmap['g']='f';
	hasmap['h']='g';
	hasmap['j']='h';
	hasmap['k']='j';
	hasmap['l']='k';
	hasmap[';']='l';
	hasmap['x']='z';
	hasmap['c']='x';
	hasmap['v']='c';
	hasmap['b']='v';
	hasmap['n']='b';
	hasmap['m']='n';
	hasmap[',']='m';
}

int main(){
	int t;
	initilmap();
	cin>>t;
	for(int i=0;i<t;i++){
		string str;
		cin>>str;
		string res;
		for(int j=0;j<str.length();j++){
			res+=hasmap[str[j]];
		}
		cout<<res<<endl;
	}
}

Double click to view unformatted code.


Back to problem 3851