Solution PTA Python programming base of the title set (7-31)
Rotate Left String 7-31 (20 minutes)
Enter a string and a non-negative integer N, the string loop in claim left N times.
Input format:
input does not exceed a given length of 100 characters with a carriage return at the end of the non-empty string in line 1; line 2 gives the non-negative integer N.
Output format:
in one line of N times the output string to the left.
Sample input:
the Hello World!
2
Sample output:
! The LLO World of He
str1 = input()
N = int(input())
if N > len(str1):
N -= len(str1)
str1 = str1[N:] + str1[:N]
print(str1)