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