You are viewing a single comment's thread. Return to all comments →
This worked for me:
from collections import Counter n = int(input()) for _ in range(n): test = input() length = len(test) if len(test) % 2 != 0: print("-1") else: s1 = Counter(test[:length//2]) s2 = Counter(test[length//2:]) diff = s1 - s2 print(sum(diff.values()))
Seems like cookies are disabled on this browser, please enable them to open this website
Anagram
You are viewing a single comment's thread. Return to all comments →
This worked for me: