[Problem-solving report] 10082 - WERTYU

Subject to the effect

Original title: http://uva.onlinejudge.org/external/100/10082.pdf

background:

Common typing error is hands on the keyboard of a correct position rowto rights. Therefore, type "Q" "W" and "J" type "K", and the like. You are decoded message to the game in this way.
The input contains several lines of text. Each row can contain numbers, spaces, (in addition to Q, A, Z), uppercase letters or punctuation shown above [( ') except back single quotes]. It represents the input of [tab, BackSp, control] the key word is not on the label. On your left QWERTY keyboard to be shown immediately above it or a replacement function for each letter symbols. Spaces to be input in the output response.

 

Sample Input

O S, GOMR YPFSU/

Output for Sample Input

I AM FINE TODAY

algorithm:

Do not say the code. (Laughing)

 

 

Code:

Here attached my code, you can go here to submit your code to verify your code is correct.

View Code
#include<stdio.h>
int main()
{
    char a;
    while((a=getchar())!=EOF)
    {
        if(a=='`')printf("  ");
        else if(a=='1')printf("`");
        else if(a=='2')printf("1");
        else if(a=='3')printf("2");
        else if(a=='4')printf("3");
        else if(a=='5')printf("4");
        else if(a=='6')printf("5");
        else if(a=='7')printf("6");
        else if(a=='8')printf("7");
        else if(a=='F')printf("D");
        else if(a=='G')printf("F");
        else if(a==';')printf("L");
        else if(a=='\'')printf(";");
        else if(a=='Z')printf("'");
        else if(a=='X')printf("Z");
        else if(a=='C')printf("X");
        else if(a=='V')printf("C");
        else if(a=='B')printf("V");
        else if(a=='N')printf("B");
        else if(a=='M')printf("N");
        else if(a==',')printf("M");
        else if(a=='.')printf(",");
        else if(a=='9')printf("8");
        else if(a=='0')printf("9");
        else if(a=='-')printf("0");
        else if(a=='H')printf("G");
        else if(a=='J')printf("H");
        else if(a=='K')printf("J");
        else if(a=='L')printf("K");
        else if(a=='=')printf("-");
        else if(a=='Q')printf("=");
        else if(a=='W')printf("Q");
        else if(a=='E')printf("W");
        else if(a=='R')printf("E");
        else if(a=='T')printf("R");
        else if(a=='Y')printf("T");
        else if(a=='U')printf("Y");
        else if(a=='I')printf("U");
        else if(a=='O')printf("I");
        else if(a=='P')printf("O");
        else if(a=='[')printf("P");
        else if(a==']')printf("[");
        else if(a=='\\')printf("]");
        else if(a=='A')printf("\\");
        else if(a=='S')printf("A");
        else if(a=='D')printf("S");
        else if(a=='/')printf(".");
        else if(a>='a'&&a<='z')printf("  ");
        else printf("%c",a);
    }
return 0;
}

 

Reproduced in: https: //www.cnblogs.com/qisong178878915/archive/2013/02/22/2922610.html

Guess you like

Origin blog.csdn.net/weixin_33829657/article/details/94237245
Recommended