Simple Java solution
Intuition:\nWe just need to validate the strings that we can move the chars and make target from start or not.\nWe\'ll check for all the invalid cases and at th
**Intuition:**\nWe just need to validate the strings that we can move the chars and make target from start or not.\nWe\'ll check for all the invalid cases and at the end return true;\n    \nSo we\'ll push \'L\' and \'R\' from both the strings along with their index to their respective stacks\nwe\'ll interate the strings from end so that at the end we\'ll have string in the original order in the stacks.\n\nNow \ncase 1: is stack size is different i.e either string have extra chars so can\'t generate target from start. \ncase 2: sequence of chars are not matching i.e somewhere R is before L so can\'t generate target from start.\ncase 3: if index of L in target is to the right of L in start then we can\'t generate target from start as we can\'t move L to right.\ncase 4: if index of R in target is to the left of R in start then we can\'t generate target from start as we can\'t move R to left.\n```\nclass Solution {\n    \n    class Pair{\n        char c;\n        int idx;\n        \n        Pair(char cc, int idx){\n            this.c = cc;\n            this.idx = idx;\n        }\n    }\n    public boolean canChange(String start, String target) {\n        \n        int idx = 0;\n        int n = start.length();\n        Stack<Pair> s1 = new Stack<>();\n        Stack<Pair> s2 = new Stack<>();\n        \n        // Fill the stacks\n        for(int i = n-1; i >=  0; i--){\n            \n            if(start.charAt(i) == \'L\' || start.charAt(i) == \'R\'){\n                s1.push(new Pair(start.charAt(i), i));\n            }\n            \n            if(target.charAt(i) == \'L\' || target.charAt(i) == \'R\'){\n                s2.push(new Pair(target.charAt(i), i));\n            }\n            \n        }\n        \n        // Early return \n        if(s1.size() != s2.size()){\n            return false;\n        }\n        \n        // Validates both the sequinces\n        while(!s1.isEmpty()){\n            \n            Pair s = s1.pop();\n            Pair e = s2.pop();\n            \n            if(s.c != e.c){\n                return false;\n            }\n            \n            if(s.c == \'L\' && e.c == \'L\'){\n                if(e.idx > s.idx){\n                    return false;\n                }\n            }\n            \n            \n            if(s.c == \'R\' && e.c == \'R\'){\n                if(e.idx < s.idx){\n                    return false;\n                }\n            }\n        }\n        \n        \n        return true;\n    }\n}\n```
['Java']