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;
}
目录
相关文章
Uva10001 Garden of Eden
Uva10001 Garden of Eden
47 0
uva 10340 all in all
输入两个字符串s和t,判断是否可以从t中删除0个或多个字符(其他字符顺序不变),得到字符串是。
42 0
UVa10123 No Tipping
UVa10123 No Tipping
62 0
UVa11968 - In The Airport
UVa11968 - In The Airport
58 0
|
算法
UVA题目分类
题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics 10300 - Ecological Premium 458 - The Decoder 494...
1570 0
uva 11627 Slalom
点击打开链接uva 11627 思路:二分答案 分析: 1 给定S个滑雪板的速度,问是否可以找到一个滑板使得通过所有的门的时间最少,如果找不到输出IMPOSSIBLE 2 很明显的二分题目,我们知道了二分那应该怎么判断是否可以通过所有...
1067 0
uva10340 Ail in All
题意:输入两个字符串s和t,判断是否可以从t种删除0个或多个字符(其他字符不变),得到字符串s,比如abcde可以得到bce,单数无法得到dc 分析:简单模拟即可 1 #include 2 #include 3 #include 4 #define zz 5 usin...
576 0
UVA3295
题意:给出一个a*b的网格,在网格上取不共线的三点构成三角形,求三角形总数。分析:就是一一道简单的组合数计算题目,设总结点数为n,则取三个节点的个数为C(n,3),然后减去横向、竖向、斜向的三点共线的个数即可,斜线三点共线等价于所枚举的矩形的长宽成倍数关系,即gcd不为1 代码如下: #incl...
660 0
|
人工智能
uva3177BeijingGuards
题意:有n个人围城一个圈,其中第i个人想要ri个不同的礼物,相邻的两个人可以聊天,炫耀自己的礼物,如果两个相邻的人拥有同一种礼物,则双方都会很不高兴。问:医用需要多少种礼物才能满足所有人的需要?假设每种礼物有无穷多个,不相邻的两个人不会一起聊天。
753 0