[Python3] 8-line deque
\n\nclass Solution:\n    def isTransformable(self, s: str, t: str) -> bool:\n        if sorted(s) != sorted(t): return False # edge case \n        \n        pos
\n```\nclass Solution:\n    def isTransformable(self, s: str, t: str) -> bool:\n        if sorted(s) != sorted(t): return False # edge case \n        \n        pos = [deque() for _ in range(10)]\n        for i, ss in enumerate(s): pos[int(ss)].append(i)\n            \n        for tt in t: \n            i = pos[int(tt)].popleft()\n            for ii in range(int(tt)): \n                if pos[ii] and pos[ii][0] < i: return False # cannot swap \n        return True \n```
['Python3']