Simple C++ Solution with explanation
Idea is that L moves backwards (XL->LX) and R moves forwards (RX->XR) so L is decremented and R is incremented. Parallely at the same position of end string, L 
Idea is that L moves backwards (XL->LX) and R moves forwards (RX->XR) so L is decremented and R is incremented. Parallely at the same position of end string, L will be incremented and R will be decremented. At any point, if the count of L or R becomes -ve then return false. \n\nNote that L cannot move beyond R and R cannot move beyond L. Like mentioned in the HINT.\n\nFor example: \n"XXXXXLXXXLXXXX"\n"XXLXXXXXXXXLXX"\n\nWhen start[i] has \'L\' it means, we should  have already encountered \'L\' in end string somewhere before this. In this example, for the second L which comes before second L in end string. Hence \'L\' count becomes -ve and answer is false.\n\nSimilarly, when end[i] has \'R\' it means, we should have already encountered \'R\' in start string before this. If thats not the case then again \'R\' count will become -ve and answer will be false.\n```\nclass Solution {\npublic:\n    bool canTransform(string start, string end) \n    {\n        int L=0,R=0;\n        \n        for(int i=0;i<start.size();i++)\n        {\n            if(start[i]==\'L\')\n                L--,R=0; // Reset count of R to zero because previous \'R\' characters cannot move beyond \'L\' so reset it to zero.  If end[i] has \'R\' character then R becomes -ve and returns false or if there is L then L is incremented;\n            else if(start[i]==\'R\')\n                R++,L=0; // Reset count of L to zero because previous \'L\' characters cannot move beyond \'R\' so reset it to zero. If end[i] \'R\' then \'R\' count is decremented and if there is \'L\' then L is incremented;\n            \n            if(end[i]==\'L\')\n                L++;\n            else if(end[i]==\'R\')\n                R--;\n            \n            if(L<0 or R<0)\n                return false;\n        }\n        if(L>0 or R>0)\n            return false;\n        return true; // If both L and R are zero then return true else return false;\n    }\n};\n```\n
[]