4ms 99% simple C++ solution
The relative position of R and L can\'t be changed. Since R can only move back and L can only move forward, the position of R in the "end" can\'t be less than i
The relative position of R and L can\'t be changed. Since R can only move back and L can only move forward, the position of R in the "end" can\'t be less than it in the start, the position of L in the "end" can\'t be larger than that of in the "start". "X"s are like "spaces". \n```\nclass Solution {\npublic:\n    bool canTransform(string start, string end) {\n        if(start.size()!=end.size()) return false;\n        int i=0, j=0;\n        while(i<start.size() && j<end.size()){\n            while(start[i]==\'X\') i++;\n            while(end[j]==\'X\') j++;\n            if(start[i]!=end[j]) return false;\n            if(start[i]==\'R\' && i>j) return false;\n            if(start[i]==\'L\' && i<j) return false;\n            i++;\n            j++;\n        }\n        return true;\n    }\n};\n```
[]