关闭

WERTYU

标签: c++acm
603人阅读 评论(0) 收藏 举报
分类:
题目1093:WERTYU

时间限制:1 秒

内存限制:32 兆

特殊判题:

提交:1079

解决:397

题目描述:

    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 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.

输出:

    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.

样例输入:
O S, GOMR YPFSU/
样例输出:
I AM FINE TODAY.
#include<iostream>
using namespace std;
 
int main()
{
    int i,l;
    char index[100];
    string s="`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./",ss;
    for(i=1,l=s.size();i<l;++i)
         index[s[i]]=s[i-1];
    index[' ']=' ';
    while(getline(cin,ss))
    {
         for(i=0,l=ss.size();i<l;++i)
             cout<<index[ss[i]];
         cout<<endl;
    }
    return 0;
}
/**************************************************************
    Problem: 1093
    User: 3011216016
    Language: C++
    Result: Accepted
    Time:0 ms
    Memory:1520 kb
****************************************************************/


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:162284次
    • 积分:3421
    • 等级:
    • 排名:第10209名
    • 原创:177篇
    • 转载:24篇
    • 译文:2篇
    • 评论:19条
    文章分类
    最新评论