시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 12 11 11 100.000%

문제

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.

예제 입력 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