Imagine R and L as walker
This is actually a good quesion. Why does everybody donw vote it. We can imagine R as the walker who can only walk right, and L as the walker who can only walk 
This is actually a good quesion. Why does everybody donw vote it. We can imagine R as the walker who can only walk right, and L as the walker who can only walk left. X is the empty space that walkers can pass through\n```\nclass Solution {\n    public boolean canTransform(String start, String end) {\n        int i = 0, j = 0;\n        if(start.length() != end.length()) return false;\n        while(i < start.length() && j < end.length()){\n            while(i < start.length() && start.charAt(i) == \'X\') ++i;\n            while(j < end.length() && end.charAt(j) == \'X\') ++j;\n            if(i == start.length() || j == end.length()) break;\n            if(start.charAt(i) != end.charAt(j)) return false;\n            if(start.charAt(i) == \'R\' && i > j) return false;\n            else if(start.charAt(i) == \'L\' && i < j) return false;\n            ++i;\n            ++j;\n        }\n        while(i < start.length() && start.charAt(i) == \'X\') ++i;\n        while(j < end.length() && end.charAt(j) == \'X\') ++j;\n        return i == j;\n    }\n}\n```
[]