시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB81655979.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로 설정하면 확인할 수 있다.

예제 입력 1

3
hobbit 2
unexpected 3
journey 4

예제 출력 1

Shifting hobbit by 2 positions gives us: ithobb
Shifting unexpected by 3 positions gives us: tedunexpec
Shifting journey by 4 positions gives us: rneyjou