Lapindromes

ct = int(input())
for i in range(ct):
    s = input()
    l_count = len(s)
    if l_count&1 == 1:
        split_count = l_count //2
        first_half = s[0:split_count]
        second_half = s[split_count+1:]
        l_first_half = list(first_half)
        l_second_half = list(second_half)
        if l_first_half == l_second_half or l_first_half == l_second_half[::-1] :
            if len(first_half) == len(second_half):
                print("YES")
            else:
                print("NO")
        else:
            print("NO")
    else:
        split_count = l_count //2
        first_half = s[0:split_count]
        second_half = s[split_count:]
        l_first_half = list(first_half)
        l_second_half = list(second_half)
        if l_first_half == l_second_half or l_first_half == l_second_half[::-1]:
            if len(first_half) == len(second_half):
                print("YES")
            else:
                print("NO")
        else:
            print("NO")

Can someone Correct the issue what is wrong here I am getting wrong answer

Please format your code - the forum software has mangled it and it won’t compile! :slight_smile:

Did you forget to sort the list?