UVa 10082 WERTYU
2015-10-23 16:13
483 查看
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.
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; }
相关文章推荐
- 动态规划进阶篇
- bug记录:ORA-00904和ORA-00984
- MD5加密
- Spring Dynamic Modules - DMserver
- vijosP1071 新年趣事之打牌
- lr_convert_string_encoding中文字符转换
- nginx 编译安装过程优化
- H5新特性-慕课01-新增与删除的标签
- Android.mk简介
- 把Emacs配置成C++和LaTeX环境
- unix学习笔记------msgctl函数的使用
- 互联网专家资源分享(一)
- Oracle中TO_DATE格式
- svn入门
- 函数递归时,递归次数到900多时,就是抛出异常exception RuntimeError('maximum recursion depth exceeded',)
- 总结css中单位px和em,rem的区别
- 【多线程】Java并发编程:Lock(转载)
- LeetCode OJ:Path Sum(路径之和)
- java异常架构图 和几个面试题
- 交大研究生去日本签证攻略