Python 3 with explanation
\n\nFound idea in discussion, replacing names to make it readable. The first idea is \'RX\' can be replaced only with \'XR\', which means that \'R\' is always m
\n\nFound idea in discussion, replacing names to make it readable. The first idea is \'RX\' can be replaced only with \'XR\', which means that \'R\' is always moving to the right position if replacement was done.  If many replacements done, \'R\' can move to the right so many times until there is a \'L\' on the road or the end of string, then \'R\' can not move further.  \'L\' has an opposite behaviour - it can move only to the left side from previous position and it can move until \'R\' is found or until it reach the beginning of string. \nSo we will check 2 coditions - 1. we remove all X and we check that order of \'R\' and \'L\' in strings stays same (you remembre \'R\' can no move further if \'L\' is met and opposite). 2. We will start checking on which position R was in Start string and where it is in End string. If we found that R somehow moved to the left (R must always move to right) then we can not make End string by replacement. Same with L - if we found that at End string it\'s position is more right than in Start - this means we wan\'t be able to create End string with replacemnt. \n\n```\nclass Solution:\n    def canTransform(self, start: str, end: str) -> bool:\n        if start.replace(\'X\', \'\') != end.replace(\'X\', \'\'): #check 1st condition\n            return False\n        \n        posInEnd = 0\n        for posInStart in range(len(start)):\n            currentChar = start[posInStart]\n            if currentChar == \'X\':\n                continue\n            else:\n                while end[posInEnd] != currentChar : \n                    posInEnd += 1 # we skip all chars until we found first occurance of currentChar,\n\t\t\t\t\t# we don\'t check if skipped positions have \'X\' or \'R\' or \'L\' because we already confirmed \n\t\t\t\t\t# that \'R\' and \'L\' are having same order is strings during 1st condition check\n                if currentChar == \'R\':\n                    if posInEnd < posInStart:\n                        return False\n                elif currentChar == \'L\': \n                    if posInEnd > posInStart:\n                        return False\n                posInEnd += 1 # we move to next char because current was confirmed\n        \n        return True # all checks are passed, we can create End from Start\n
[]