Simple Java two stack approach.
\nclass Solution {\n    public boolean backspaceCompare(String S, String T) {\n       Stack<Character> s1=new Stack<>();\n        Stack<Character> s2=new Stack<
```\nclass Solution {\n    public boolean backspaceCompare(String S, String T) {\n       Stack<Character> s1=new Stack<>();\n        Stack<Character> s2=new Stack<>();\n        int i=0;\n       for(char c:S.toCharArray())\n       {\n           if(c!=\'#\')\n               s1.push(c);\n           else if(!s1.isEmpty())\n               s1.pop();\n       }\n        for(char c:T.toCharArray())\n       {\n           if(c!=\'#\')\n               s2.push(c);\n           else if(!s2.isEmpty())\n               s2.pop();\n       }\n        while(!s1.isEmpty() && !s2.isEmpty())\n        {\n            char c=s1.pop();\n            if(c!=s2.pop())\n                return false;\n            \n        }\n        return s1.isEmpty() && s2.isEmpty();\n        \n    }\n}\n```
['Stack', 'Java']