|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|1 초||128 MB||81||65||59||79.730%|
Bilbo wants to send a message to the dwarves, currently being held prisoners by the Great Goblin. He has a mechanism to get it to the dwarves, but there is a chance that the orcs may intercept the message. So he decides to encrypt the message using a very simple scheme (sucient to fool the orcs, who are not known for their IQs).
ically, he decides to shift the letters in every word in the message toward the right (wrapping around appropriately) by a small number. For example, shifting “oakenshield” by 3 gives him “eldoakenshi”, whereas shifting “gandalf” by 2 gives him “lfganda”. He chooses to shift every word by a different number of letters, always less than the number of letters in the word.
You are to write a program to help Bilbo encode his message.
The first line in the test data file contains the number of test cases (< 100). After that, each line contains one test case, a word, w, (provided as a String) followed by an integer, n (int). You can assume that: 0 < n < length(w).
For each test case, you are to output the word formed by shifting every letter in w to the right by n, and wrapping around to the beginning appropriately. The exact format is shown below in the examples.
정확한 출력 형식은 제출에서 언어를 Java로 설정하면 확인할 수 있다.
3 hobbit 2 unexpected 3 journey 4
Shifting hobbit by 2 positions gives us: ithobb Shifting unexpected by 3 positions gives us: tedunexpec Shifting journey by 4 positions gives us: rneyjou