https://codeforces.com/problemset/problem/474/A

题目分析

英语阅读题。

代码实现

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

unordered_map <char,char> l, r;
void helper(string s) {
    for (int i = 0; i < (int)s.length(); ++i) {
        if (i - 1 >= 0) l[s[i]] = s[i - 1];
        if (i + 1 < (int)s.length()) r[s[i]] = s[i + 1];
    }
}
int main () {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    char op;
    cin >> op >> s;
    helper("qwertyuiop"), helper("asdfghjkl;"), helper("zxcvbnm,./");
    for (const auto& i : s) {
        if (op == 'R') cout << l[i];
        else cout << r[i];
    }
    return 0;
}
分类: Thought

0 条评论

发表回复

Avatar placeholder

您的电子邮箱地址不会被公开。 必填项已用*标注

友情链接:Ctips' blog, Colza’s blog

站点状态:Status