View Code of Problem 3851

#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int main(void)
{
    string arr[3] = {"qwertyuiop[]",
                     "asdfghjkl;'",
                     "zxcvbnm,./"};
    int n;
    string str;
    cin >> n;
    getchar();
    while (n--)
    {
        cin >> str;
        for (int i = 0; i < str.size();i++){
            int j;
            for (j = 0; j < 3; j++){
                if(arr[j].find(str[i]) != string :: npos)
                    break;
            }
            cout << arr[j][arr[j].find(str[i])-1];
        }
        cout << endl;
    }
}

Double click to view unformatted code.


Back to problem 3851