Python simple solution, 3 lines O(n)
The idea it to compare 'L' position in start is greater than or equal to that in end, also 'R' position in start is less than or equal to that in end.\n\nThe re
The idea it to compare 'L' position in start is greater than or equal to that in end, also 'R' position in start is less than or equal to that in end.\n\nThe reason is 'L' can move left when 'X' exists before, and 'R' can move right when 'X' exists after, and 'L' and 'R' cannot cross each other, so we do not care about 'X'.\n```\nclass Solution:\n    def canTransform(self, start, end):\n        """\n        :type start: str\n        :type end: str\n        :rtype: bool\n        """\n        s = [(c, i) for i, c in enumerate(start) if c == 'L' or c == 'R']\n        e = [(c, i) for i, c in enumerate(end) if c == 'L' or c == 'R']\n        return len(s) == len(e) and all(c1 == c2 and (i1 >= i2 and c1 == 'L' or i1 <= i2 and c1 == 'R') for (c1, i1), (c2, i2) in zip(s,e))\n```
[]