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. nyoj 37回文串

    述所谓回文字符串,就是一个字符串,从左到右读和从右到左读是完全一样的,比如"aba".当然,我们给你的问题不会再简单到判断一个字符串是不是回文字符串.现在要求你,给你一个字符串,可 ...

  2. 2D游戏编程3—GDI

    WM_PAINT消息触发程序重新绘制界面,过程如下: PAINTSTRUCT    ps;    // used in WM_PAINT HDC        hdc;    // handle to ...

  3. 常用的Git命令

    我的常用的Git命令 Git仓库配置常用 1. clone 克隆一份远程的Git版本库 git clone git://github.com/someone/some_project.git some ...

  4. python爬虫学习(3)_模拟登陆

    1.登陆超星慕课,chrome抓包,模拟header,提取表单隐藏元素构成params. 主要是验证码图片地址,在js中发现由js->new Date().getTime()时间戳动态生成url ...

  5. 再次分享 pyspider 爬虫框架 - V2EX

    再次分享 pyspider 爬虫框架 - V2EX block

  6. Java 8 简明教程

    欢迎阅读我编写的 Java 8 介绍.本教程将带领你一步步认识这门语言的所有新特性.通过简单明了的代码示例,你将会学习到如何使用默认接口方法,Lambda表达式,方法引用和可重复注解.在这篇教程的最后 ...

  7. YII 权限管理

    CREATE TABLE IF NOT EXISTS `admin_role` ( `id` ) unsigned NOT NULL auto_increment, `name` ) NOT NULL ...

  8. storm spout的速度抑制问题

    转发请注明原文地址:http://www.cnblogs.com/dongxiao-yang/p/6031398.html 最近协助同事优化一个并发消费kafka数据用来计算的任务,压测过程中发现有两 ...

  9. Python自动化之session

    request.body 所有请求内容的原生数据 request.META 所有请求头的原生数据 cookie返回存在于响应头里面 session session是保存在服务端的键值对 cookie和 ...

  10. 推荐一个可以直接在Visual Studio中看到complexity的插件CodeMaid

    博客搬到了fresky.github.io - Dawei XU,请各位看官挪步.最新的一篇是:推荐一个可以直接在Visual Studio中看到complexity的插件CodeMaid.