View Code of Problem 3851

#include<iostream>
using namespace std;
#include<string>

char getletter(char c,char array[][20])
{
	for(int i=0;i<3;i++)
	{
		for(int j=0;j<20;j++)
		{
			if(array[i][j]==c)
			{
				return array[i][j-1];
			}
		}
	}
}
int main()
{
	char array[3][20]={{'q','w','e','r','t','y','u','i','o','p','['},{'a','s','d','f','g','h','j','k','l',';'},
	{'z','x','c','v','b','n','m',','}};
	int t;
	cin>>t;
	string str2;
	while(t--)
	{
		cin>>str2;
		for(int i=0;i<str2.size();i++)
		{
			cout<<getletter(str2[i],array);
		}
		cout<<endl;
	}
}

Double click to view unformatted code.


Back to problem 3851