Codeforces 474 A

Source: Internet
Author: User

Click here ~ ~

A. Keyboard***our good friend Mole isTrying toCode a big message. He isTyping onAn unusual keyboard with charactersArrangedinchFollowing way:qwertyuiopasdfghjkl;zxcvbnm,./unfortunately Mole isblind, so sometimesit  isProblem forHim to putHis hands accurately. He accidentally moved both his hands withOne position to  theLeftor  to  theRight. That means thatNow he presses notA button he wants, butOne neighboring button (leftorRight asSpecifiedinchInput). We have a sequence of charactersHe has typed andWe want toFind theOriginal message. Inputfirst Line of  theInputcontainsOne letter describing direction ofShifting (' L ')or' R ' respectively forLeftorright). Second LinecontainsA sequence of charactersWritten byMole. The size ofThis sequence'll be is no more than.SequencecontainsOnly symbols thatAppear onMole ' s keyboard. Itdoesn ' t containSpaces asThere isNoSpace  onMole ' s keyboard. It isGuaranteed thatEven though Mole hands is moved, he isStill pressing buttons onKeyboard and  notHitting outsideit. Outputprint a line that contains  theOriginal message. Sample Test (s) inputrs;; Upimrrfod;pbroutputallyouneedislove

The main idea: is to give you a string, let you move to the right or left one

Directly on the code bar, too much water ...

/*2015-8-29 Noon Author:itak Today I want to go beyond yesterday's I, tomorrow I will surpass today's me, to create better code for the goal, constantly surpass themselves. */#include <iostream>#include <cstring>using namespace STD;Charstr[ the];Charst[ the];Chars[ to] = {"qwertyuiopasdfghjkl;zxcvbnm,./"};intMain () {CharC while(Cin&GT;&GT;C) {Cin>>str;intLen =strlen(str);if(c = =' R ')        { for(intI=0; i<len; i++) { for(intj=0; j< -; J + +) {if(Str[i] = = S[j]) {cout<<s[j-1]; Break; }                }            }        }Else{ for(intI=0; i<len; i++) { for(intj=0; j< -; J + +) {if(Str[i] = = S[j]) {cout<<s[j+1]; Break; }                }            }        }    }return 0;}

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Codeforces 474 A

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.