P26500 [AtCoder] Rolling Old Man and the Sea
普及+
题目描述

Problem Description

Iroha-chan, a book lover, noticed that moving the first character of the string "Old Man and the Sea" to the end results in "ld Man and the SeaO". For her favorite book title $ S $, please answer the string obtained by performing the operation "move the first character to the end" $ K $ times.

Input Format

The input is given from the standard input in the following format:

$ S $ $ K $

Output Format

Output the string obtained by performing the operation on $ S $ $ K $ times in one line. Make sure to include a newline at the end.

Sample Input and Output

Sample Input #1

JKrolling
2

Sample Output #1

rollingJK

Sample Input #2

JKrolling
99

Sample Output #2

JKrolling

Sample Input #3

iroha
168

Sample Output #3

hairo

Sample Input #4

EARTH
444

Sample Output #4

HEART

Notes/Hints

Constraints

  • $1 \leq |S| \leq 1000$
  • $0 \leq K \leq 1000$
  • $ S $ is a string consisting of alphanumeric characters

Sample Explanation 1

Performing the operation once on JKrolling results in KrollingJ, and performing it once more results in rollingJK.

Sample Explanation 2

The original string is restored every 9 operations.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
JKrolling 2
样例输出
rollingJK