You don’t need to sort the strings otherwise you will change the question itself.
You can do this
a = input()
b = input()
a = a.lower()
b = b.lower()
if a == b:
print("0")
elif a > b:
print('1')
elif a < b:
print('-1')
3
solved How can I solve this lexographical sorting question from codeforces.com? [closed]