compare two string in python
>>> s1="abc def ghi"
>>> s2="def ghi abc"
>>> s1 == s2
False
>>> sorted(list(s1)) == sorted(list(s2)) For comparing if they have same characters.
True
>>> sorted(list(s1))
[' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
>>> sorted(list(s2))
[' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
another method
if same character than this method apply
>>> s1="abc def ghi"
>>> s2="def ghi abc"
>>> from collections import Counter
>>> Counter(string1) == Counter(string2)
True
if you know more about python concept and also string related concept than you can join