python O(n) solution
both strings must have equal character counts\n for any substring end[:i], the number of R characters must be <= those in start, since Rs only move to the right
* both strings must have equal character counts\n* for any substring `end[:i]`, the number of `R` characters must be `<=` those in `start`, since `Rs` only move to the right\n* for any substring `end[:i]`, the number of `L` characters must be `>=` those in `start`, since `Ls` only move to the left\n* an `L` and an `R` cannot cross each other, so we must see the same blocks of consecutive `Ls` and `Rs` in both strings. This can be verified by ignoring the `X` characters\n\n```\nclass Solution(object):\n    def canTransform(self, start, end):\n        """\n        :type start: str\n        :type end: str\n        :rtype: bool\n        """\n\n        if collections.Counter(start)!=collections.Counter(end):\n            return False\n        \n        \n        a,b=0,0\n        \n        c,d=0,0\n        \n        for i in xrange(len(end)):\n            a+=start[i]=='R'\n            b+=end[i]=='R'\n            if a<b: return False\n            \n            c+=start[i]=='L'\n            d+=end[i]=='L'\n            if c>d: return False\n        \n        return start.replace("X", "")==end.replace("X", "")\n```
[]