• + 0 comments

    for Python3 Platform

    def anagram(s):
        if (len(s) % 2 != 0):
            return -1
        else:
            lst = list(s[len(s)//2:])
            
            for i in s[:len(s)//2]:
                if (i in lst):
                    lst.remove(i)
            
            return len(lst)
    
    q = int(input())
    for j in range(q):
        s = input()
        
        result = anagram(s)
        
        print(result)