View Code of Problem 3851

#include<iostream>
using namespace std;
string str1 = "qwertyuiop[", str2 = "asdfghjkl;", str3 = "zxcvbnm,";
int main()
{
	int t;
	cin >> t;
	while(t --)
	{
		string s;
		cin >> s;
		for(int i = 0;i < s.size();i ++)
		{
			if(str1.find(s[i]) != -1)
			{
				cout << str1[str1.find(s[i]) - 1];
			}
			else if(str2.find(s[i]) != -1)
			{
				cout << str2[str2.find(s[i]) - 1];
			}
			else
			{
				cout << str3[str3.find(s[i]) - 1];
			}
		}
		cout << endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 3851