UVA - 10082 WERTYU


/*
    coder: Shawn_Xue
    date: 2015.3.10
    result: AC
    description: UVA - 10082 WERTYU
*/

#include <stdio.h>
#include <string.h>
int main()
{
    char str[] ="`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";     //  转义字符'\'
    char c, tmp;
    int len, i;
    while((c = getchar()) != EOF)
    {
        len = strlen(str);
        for( i = 0; i < len; i++)   //  遍历数组,匹配
        {
            if(c == str[i])
                break;
        }
        if(i == len)
            putchar(c);
        else putchar(str[i-1]);     //  输出前一项
    }
    return 0;
}


你可能感兴趣的:(UVA - 10082 WERTYU)