Editorial for Rotate the String
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
t = int(input())
for i in range(1,t+1):
s = input()
r = int(input())
if(len(s) == 0):
r = 0
else:
r %= len(s)
ans = s[r:] + s[:r]
print(f'Case #{i}: {ans}')
Comments