Simple Brute Force Solution for Beginners || O(n+m, n+m)
Code\nJava []\nclass Solution {\n    public boolean backspaceCompare(String s, String t) {\n        StringBuilder sb1 = new StringBuilder();\n        StringBuil
# Code\n``` Java []\nclass Solution {\n    public boolean backspaceCompare(String s, String t) {\n        StringBuilder sb1 = new StringBuilder();\n        StringBuilder sb2 = new StringBuilder();\n\n        for(char ch : s.toCharArray()) {\n            if(ch == \'#\') {\n                if(!sb1.isEmpty()) {\n                    sb1.deleteCharAt(sb1.length() - 1);\n                }\n            } else {\n                sb1.append(ch);\n            }\n        }\n\n        for(char ch : t.toCharArray()) {\n            if(ch == \'#\') {\n                if(!sb2.isEmpty()) {\n                    sb2.deleteCharAt(sb2.length() - 1);\n                }\n            } else {\n                sb2.append(ch);\n            }\n        }\n\n        return sb1.toString().equals(sb2.toString());\n    }\n}\n```\n``` C++ []\nclass Solution {\npublic:\n    bool backspaceCompare(string s, string t) {\n        string sb1, sb2;\n\n        for (char ch : s) {\n            if (ch == \'#\') {\n                if (!sb1.empty()) {\n                    sb1.pop_back();\n                }\n            } else {\n                sb1.push_back(ch);\n            }\n        }\n\n        for (char ch : t) {\n            if (ch == \'#\') {\n                if (!sb2.empty()) {\n                    sb2.pop_back();\n                }\n            } else {\n                sb2.push_back(ch);\n            }\n        }\n\n        return sb1 == sb2;\n    }\n};\n```\n``` JavaScript []\n/**\n * @param {string} s\n * @param {string} t\n * @return {boolean}\n */\nvar backspaceCompare = function(s, t) {\n    let sb1 = \'\';\n    let sb2 = \'\';\n\n    for (const ch of s) {\n        if (ch === \'#\') {\n            if (sb1.length > 0) {\n                sb1 = sb1.slice(0, -1);\n            }\n        } else {\n            sb1 += ch;\n        }\n    }\n\n    for (const ch of t) {\n        if (ch === \'#\') {\n            if (sb2.length > 0) {\n                sb2 = sb2.slice(0, -1);\n            }\n        } else {\n            sb2 += ch;\n        }\n    }\n\n    return sb1 === sb2;\n};\n```\n``` C# []\npublic class Solution {\n    public bool BackspaceCompare(string s, string t) {\n        var sb1 = new System.Text.StringBuilder();\n        var sb2 = new System.Text.StringBuilder();\n\n        foreach (char ch in s) {\n            if (ch == \'#\') {\n                if (sb1.Length > 0) {\n                    sb1.Remove(sb1.Length - 1, 1);\n                }\n            } else {\n                sb1.Append(ch);\n            }\n        }\n\n        foreach (char ch in t) {\n            if (ch == \'#\') {\n                if (sb2.Length > 0) {\n                    sb2.Remove(sb2.Length - 1, 1);\n                }\n            } else {\n                sb2.Append(ch);\n            }\n        }\n\n        return sb1.ToString() == sb2.ToString();\n    }\n}\n```\n``` C []\nbool backspaceCompare(char* s, char* t) {\n    char sb1[1000] = ""; \n    char sb2[1000] = "";\n    int i, j;\n\n    for (i = 0; s[i] != \'\\0\'; i++) {\n        if (s[i] == \'#\') {\n            if (strlen(sb1) > 0) {\n                sb1[strlen(sb1) - 1] = \'\\0\';\n            }\n        } else {\n            strncat(sb1, &s[i], 1);\n        }\n    }\n\n    for (j = 0; t[j] != \'\\0\'; j++) {\n        if (t[j] == \'#\') {\n            if (strlen(sb2) > 0) {\n                sb2[strlen(sb2) - 1] = \'\\0\';\n            }\n        } else {\n            strncat(sb2, &t[j], 1);\n        }\n    }\n\n    return strcmp(sb1, sb2) == 0;\n}\n```
['String', 'C', 'C++', 'Java', 'JavaScript', 'C#']