Submit solution
Points:
10 (partial)
Time limit:
1.0s
Memory limit:
32M
Authors:
Problem type
Allowed languages
Python
Problem Statement
You are given a string and an integer . Your task is to rotate the string S to the left by positions and return the result. If is negative, you should rotate the string to the right by the absolute value of positions and return the result.
Input Specification
The first line of the input gives the number of test cases, , test cases follow. Each test case consists of two lines. The first line contains a string .
The second line contains a integer , representing the number of positions you need to rotate.
Limits
Memory limits: 32MB.
Time limits: 1 second.
Test Set 1
Sample Case
Test Set 2
Test Set 3
Test Set 4
Output Specification
For each test case, output one line containing Case #x: y
, where is the case number(starting from 1) and is the result of rotating S by R positions.
Sample Input
2
Hello World
2
Python
1
Sample Output
Case #1: llo WorldHe
Case #2: ythonP
Hint
slice operator
Comments