java simple solution o(n)
rnum:  there are rnum of \'R\' need to move to right;\nlnum: there are lnum of \'L\' need to move to left;\n\nclass Solution {\n    public boolean canTransform(
rnum:  there are rnum of \'R\' need to move to right;\nlnum: there are lnum of \'L\' need to move to left;\n```\nclass Solution {\n    public boolean canTransform(String start, String end) {\n        if (start.length() != end.length()) return false;\n        int rnum = 0, lnum = 0;\n        for (int i = 0; i < start.length(); i++) {\n            if (start.charAt(i) == \'R\') {\n                rnum++;\n            }\n            if (start.charAt(i) == \'L\') {\n                lnum--;\n            }\n\t\t\t// if there are R need to move to right , but there are some L obstacles \n            if (rnum > 0 && lnum != 0) return false;\n            if (end.charAt(i) == \'R\') {\n                rnum--;\n            }\n            if (end.charAt(i) == \'L\') {\n                lnum++;\n            }\n\t\t\t// there are R in right , or L in left\n            if (rnum < 0 || lnum < 0) return false;\n\t\t\t// there are obstacles when we move R or L;\n            if (rnum > 0 && lnum > 0) return false;\n        }\n        return rnum == 0 && lnum == 0;\n    }\n}\n```
['Java']