Really concise and fast C++ code 8ms
\nclass Solution {\npublic:\n    bool canTransform(string start, string end) {\n        int n = start.length();\n        if(n != end.length()) return false;\n  
```\nclass Solution {\npublic:\n    bool canTransform(string start, string end) {\n        int n = start.length();\n        if(n != end.length()) return false;\n        int l1 = 0, l2 = 0, r1 = 0, r2 = 0;\n        for(int i = 0; i < n; ++i){\n            if(start[i] == \'L\') ++l1;\n            else if(start[i] == \'R\') ++r1;\n            if(end[i] == \'L\') ++l2;\n            else if(end[i] == \'R\') ++r2;\n            if(l1 > l2 || r1 < r2 || (l1 < l2 && r1 > r2)) return false;\n        }\n        return l1==l2 && r1==r2;\n    }\n};\n```
[]