Clean and concise C++ code based on Two pointers. One pass, O(N) time, O(1) space.
Intuition\n Describe your first thoughts on how to solve this problem. \n(1)The relative order of \'X\' and \'R\' in both strings must be the same.\n\n(2-1)For 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n(1)The relative order of \'X\' and \'R\' in both strings must be the same.\n\n(2-1)For any \'L\',  its position in "start" must to the right of that in "end", b/c \'L\' can only move to left. \n\n(2-2)For any \'R\', then its position in "start" must to the left of that in "end", b/c \'R\' can only move to right.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nTwo pointers. One pass. If any of the above conditions are violated, return false. Otherwise, rethen true.\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n$$O(n)$$\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n$$O(1)$$\n# Code\n```\nclass Solution {\npublic:\n    \n    bool canTransform(string start, string end) {\n        //check if all relative order of R and L are the same\n        int n = start.size();\n        int i = 0, j = 0;\n        while (i < n || j < n) {\n            while (i < n && start[i] == \'X\') i++;\n            while (j < n && end[j] == \'X\') j++;\n            \n            //here  i, j piont to \'X\' or \'R\'\n            //(1-1) If there are more \'X\' or \'R\' in one string than the other return false \n            if (i == n && j != n) return false;\n            if (i != n && j == n) return false;\n            //(1-2) \'X\' and \'R\' in both strings must have the same relative orders\n\n            if (start[i] != end[j]) return false;\n            //(2-1) If the current char is \'L\', then its position in start must to the right of that in end, b/c \'L\' can only move to left.\n            //If this is not the case, return false;\n            if (start[i] == \'L\' && j > i) return false;\n            //(2-2) If the current char is \'R\', then its position in start must to the left of that in end, b/c \'R\' can only move to right.\n            //If this is not the case, return false;\n            if (start[i] == \'R\' && j < i) return false;\n\n            i++;\n            j++;\n        }\n\n        return true;\n    }\n};\n```
['C++']