1919 旋转字串


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 32M

Problem types
Allowed languages
C, C++, Java, Python

Description

“Hello”字串,向右旋转3下,得到 “lloHe”字串。那么给出任意字串,和要求左旋或右旋的次数,就应该可以得到一个新字串。这个工作你肯定行。

Input

有多组数据,每组数据含有一个无空格字串,左旋右旋标志(1表示左旋,0表示右旋),以及一个旋转次数(范围在[1,1000000]之间)这三个数据。

Output

对应每个字串,输出旋转之后的结果字串。每个字串占一行。

Sample

Input

Hello 0 3
Good 1 3

Output

lloHe
dGoo

Source: qn


Comments

There are no comments at the moment.