我正在独自学习python,在学习任何主题时,我都去URI Online Judge解决一些问题并实践我的知识。在这个问题(https://www.urionlinejudge.com.br/judge/en/problems/view/1235中,我找不到在代码中导致运行时错误的原因。有人可以帮我吗?
import math
cases = int(input())
for i in range(0, cases):
main_string = input()
middle = int(math.trunc(len(main_string)/2))
string1 = main_string[0:middle]
string1 = string1[::-1]
string2 = main_string[-1:middle-1:-1]
print(f'{string1}{string2}')