首页 > 其他 > 详细

SDNU 1382.Problem C: WERTYU(水题)

时间:2019-07-27 19:45:23      阅读:139      评论:0      收藏:0      [点我收藏+]

Description

 

Problem C: WERTYU

技术分享图片

A common typing error is to place the hands on the keyboard one row to the right of the correct position. So "Q" is typed as "W" and "J" is typed as "K" and so on. You are to decode a message typed in this manner.

Input

Input consists of several lines of text. Each line may contain digits, spaces, upper case letters (except Q, A, Z), or punctuation shown above [except back-quote (`)]. Keys labelled with words [Tab, BackSp, Control, etc.] are not represented in the input. 

Output

You are to replace each letter or punctuation symbol by the one immediately to its left on the QWERTY keyboard shown above. Spaces in the input should be echoed in the output.

Sample Input

O S, GOMR YPFSU/

Sample Output

I AM FINE TODAY.

Source

#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
using namespace std;
#define ll long long
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;

string s;

int main()
{
    while(getline(cin, s))
    {
        int len = s.size();
        for(int i = 0; i<len; i++)
        {
            if(s[i] == 1)printf("`");
            else if(s[i] == 2)printf("1");
            else if(s[i] == 3)printf("2");
            else if(s[i] == 4)printf("3");
            else if(s[i] == 5)printf("4");
            else if(s[i] == 6)printf("5");
            else if(s[i] == 7)printf("6");
            else if(s[i] == 8)printf("7");
            else if(s[i] == 9)printf("8");
            else if(s[i] == 0)printf("9");
            else if(s[i] == -)printf("0");
            else if(s[i] == =)printf("-");
            else if(s[i] == W)printf("Q");
            else if(s[i] == E)printf("W");
            else if(s[i] == R)printf("E");
            else if(s[i] == T)printf("R");
            else if(s[i] == Y)printf("T");
            else if(s[i] == U)printf("Y");
            else if(s[i] == I)printf("U");
            else if(s[i] == O)printf("I");
            else if(s[i] == P)printf("O");
            else if(s[i] == [)printf("P");
            else if(s[i] == ])printf("[");
            else if(s[i] == 92)printf("]");///
            else if(s[i] == S)printf("A");
            else if(s[i] == D)printf("S");
            else if(s[i] == F)printf("D");
            else if(s[i] == G)printf("F");
            else if(s[i] == H)printf("G");
            else if(s[i] == J)printf("H");
            else if(s[i] == K)printf("J");
            else if(s[i] == L)printf("K");
            else if(s[i] == ;)printf("L");
            else if(s[i] == 39)printf(";");
            else if(s[i] == X)printf("Z");
            else if(s[i] == C)printf("X");
            else if(s[i] == V)printf("C");
            else if(s[i] == B)printf("V");
            else if(s[i] == N)printf("B");
            else if(s[i] == M)printf("N");
            else if(s[i] == ,)printf("M");
            else if(s[i] == .)printf(",");
            else if(s[i] == /)printf(".");
            else if(s[i] ==  )printf(" ");
        }
        printf("\n");
    }
    return 0;
}

 

SDNU 1382.Problem C: WERTYU(水题)

原文:https://www.cnblogs.com/RootVount/p/11256299.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!