UVa 10082 WERTYU

简介: Problem DescriptionA common typing error is to place the hands on the keyboard one row to the right of the correct position.

Problem Description

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.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char s[]="`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";
int main(){
    char c;
    while((c=getchar())!=EOF){
        int i,j;
                bool flag = false;
            for(j=0;j<strlen(s);j++)
                if(c==s[j]){
                    flag=true;
                     putchar(s[j-1]);
                }
        if(flag==false)
            putchar(c);
    }
    return 0;
}
目录
相关文章
|
11月前
uva10112 Myacm Triangles
uva10112 Myacm Triangles
28 0
|
算法
UVA题目分类
题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics 10300 - Ecological Premium 458 - The Decoder 494...
1546 0
|
C++
UVA 之10010 - Where's Waldorf?
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/SunnyYoona/article/details/24863879 ...
694 0
|
机器学习/深度学习 人工智能
uva 10870 Recurrences
点击打开uva 10870 思路:构造矩阵+矩阵快速幂 分析: 1 题目给定f(n)的表达式 f(n) = a1 f(n - 1) + a2 f(n - 2) + a3 f(n -3) + .
721 0
|
JavaScript 定位技术
uva 10047 - The Monocycle
点击打开链接uva 10047 思路:bfs 分析: 1 题目给定一个起始的状态然后要求是否可以到达目标状态 2 这些状态包括了位置,方向,底面颜色。
835 0
|
人工智能
uva 11300 - Spreading the Wealth
点击打开链接uva 11300 思路:数学分析+贪心 分析: 1 首先最终每个人的金币数量可以计算出来,它等于金币总数除以人数n。接下来我们用m来表示每人的最终的金币数 2 现在假设编号为i的人初始化为Ai枚金币,Xi表示第i个人给第i-1个人Xi枚金币,对于第一个人来说他是给第n个人。
842 0
uva 11627 Slalom
点击打开链接uva 11627 思路:二分答案 分析: 1 给定S个滑雪板的速度,问是否可以找到一个滑板使得通过所有的门的时间最少,如果找不到输出IMPOSSIBLE 2 很明显的二分题目,我们知道了二分那应该怎么判断是否可以通过所有...
1050 0