Problem A: WERTYU



Description

A common typing error is to place yourhands on the keyboard one row to the right of the correct position. Then ``Q'' is typed as ``W''
and ``J'' is typed as ``K'' and so on. Your task is to decode a message typed inthis manner.



Input

Input consists ofseveral lines of text. Each line may contain digits, spaces, uppercase letters(except ``Q'', ``A'', ``Z''), or punctuation shown above [except back-quote(`)]. Keys labeled
with words [Tab, BackSp, Control, etc.] are not representedin the input.



Output

You are to replaceeach letter or punctuation symbol by the one immediately to its left on theQWERTY keyboard shown above. Spaces in the input should be echoed in theoutput.



Sample Input

O S, GOMR YPFSU/



Sample Output

I AM FINE TODAY.


 

/**
* 水题
* 提议就是输入一串字符,输出它在 键盘上前一位的字符 如 输入U 输出的就是Y
* ps:QAZ除外 空格原样输出
*
*/
#include <iostream>
using namespace std;
int main()
{
string s = "`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";
string line;
while(getline(cin,line))
{
for(int i = 0;i<int(line.length());i++)
{
if(line[i]==' ')
cout<<" ";
else
cout<<s[s.find_first_of(line[i])-1];
/**
* string 类的一个成员函数
* s.find_first_of(line[i])
* 找到 line[i] 在(string)s中出现的第一个值并返回(返回类型为int),没有就返回如果没找到就返回string::npos
* 详情参考 http://blog.163.com/chen_dawn/blog/static/1125063201111191617784/
*/
}
cout<<endl;
}
return 0;
}

ACM YTU 挑战编程 字符串 Problem A: WERTYU的更多相关文章

  1. (Step1-500题)UVaOJ+算法竞赛入门经典+挑战编程+USACO

    http://www.cnblogs.com/sxiszero/p/3618737.html 下面给出的题目共计560道,去掉重复的也有近500题,作为ACMer Training Step1,用1年 ...

  2. 算法竞赛入门经典+挑战编程+USACO

    下面给出的题目共计560道,去掉重复的也有近500题,作为ACMer Training Step1,用1年到1年半年时间完成.打牢基础,厚积薄发. 一.UVaOJ http://uva.onlinej ...

  3. CSDN挑战编程——《数学问题》

    数学问题 题目详情: 给你两个长度为n的正整数序列分别为{a1,a2,a3...an},{b1,b2,b3...bn},0<ai,bi<=100: 设S=max{x1*a1+x2*a2+x ...

  4. CSDN挑战编程——《绝对值最小》

    绝对值最小 题目详情: 给你一个数组A[n],请你计算出ans=min(|A[i]+A[j]|)(0<=i,j<n). 比如:A={1, 4, -3}, 则: |A[0] + A[0]| ...

  5. 挑战编程 uva100 3n+1

    挑战编程 刘汝佳 的第一道习题  热身题 熟悉下提交格式 题意 #include <iostream> #include <algorithm> using namespace ...

  6. SHELL脚本编程-字符串处理

    SHELL脚本编程-字符串处理 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.字符串切片 [root@node101.yinzhengjie.org.cn ~]# echo { ...

  7. ACM YTU 《挑战编程》第一章 入门 Problem E: Graphical Editor

    Description Graphical editors such as Photoshop allow us to alter bit-mapped images in the same way ...

  8. 烟大 Contest1024 - 《挑战编程》第一章:入门 Problem A: The 3n + 1 problem(水题)

    Problem A: The 3n + 1 problem Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 14  Solved: 6[Submit][St ...

  9. 烟大 Contest1025 - 《挑战编程》第二章:数据结构 Problem A: Jolly Jumpers(水题)

    Problem A: Jolly Jumpers Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 10  Solved: 4[Submit][Status] ...

随机推荐

  1. poj 3237 Tree(树链剖分,线段树)

    Tree Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 7268   Accepted: 1969 Description ...

  2. kvm 性能调优

    CPU Tuning Cache share tuning 对于物理 CPU,同一个 core 的 threads 共享 L2 Cache,同一个 socket 的 cores 共享 L3 cache ...

  3. 机器学习笔记1——Linear Regression with One Variable

    Linear Regression with One Variable Model Representation Recall that in *regression problems*, we ar ...

  4. 【Struts2+Spring3+Hibernate3】SSH框架整合实现CRUD_1.3

    作者: hzboy192@192.com Blog: http://my.csdn.net/peng_hao1988 版本总览:http://blog.csdn.net/peng_hao1988/ar ...

  5. Oracle ROWNUM用法和分页查询总结(转)

    [转载] Oracle的分页查询语句基本上可以按照本文给出的格式来进行套用. Oracle分页查询格式(一):http://yangtingkun.itpub.net/post/468/100278 ...

  6. 界面编程模仿篇(QQ登录界面逼真篇)

    写了好多天的爬虫,偷空前前后后用了两天的时间(排除吃饭睡觉)写完了这个QQ登录界面,看起来还凑和着吧,如果是的大神的,莫见笑,纯属业余作品,废话先不多说,截图如下,其中第二幅图片中的红色方框部份有待完 ...

  7. 几种不同风格的Toast

    一般情况下,我们使用Toast默认的风格就行了,只是有些时候为了达到我们自己想要的效果需要自定义一下,包括自定义显示的位置,显示的内容以及完全自定义里面的布局,代码如下: activity: pack ...

  8. JavaScript中七种函数调用方式及对应 this 的含义

    this 在 JavaScript 开发中占有相当重要的地位,不过很多人对this这个东西都感觉到琢磨不透.要真正理解JavaScript的函数机制,就非常有必要搞清楚this到底是怎么回事. 函数调 ...

  9. linux bash下 快捷键

    c + a # 光标跳转到最左 c + e # 光标跳转到最后 c + w # 删除最后输入的单词 c + u # 删除整行 c + k # 删除光标到末尾 c + l # 清屏 c + z # 挂起 ...

  10. 根据子级ID获取其所有父级

    当前位置>新闻中心>行业资讯 CLASSID CLASSNAME CLASSPID 1 新闻中心 0 2 行业资讯 1 3 公司新闻 1 4 媒体聚焦 0 当前位置<%=navNam ...