Three Solutions in Python 3 (With and Without Deque and Two-Pointer)
With Deque: (six lines)\n\nclass Solution:\n    def backspaceCompare(self, S: str, T: str) -> bool:\n    \ta, A = [collections.deque(), collections.deque()], [S
_With Deque:_ (six lines)\n```\nclass Solution:\n    def backspaceCompare(self, S: str, T: str) -> bool:\n    \ta, A = [collections.deque(), collections.deque()], [S,T]\n    \tfor i in range(2):\n\t    \tfor j in A[i]:\n   \t\t \t\tif j != \'#\': a[i].append(j)\n   \t\t \t\telif a[i]: a[i].pop()\n    \treturn a[0] == a[1]\n\t\t\n\t\t\n\t\t\n```\n_Without Deque:_ (four lines)\n```\nclass Solution:\n    def backspaceCompare(self, S: str, T: str) -> bool:\n    \ts, t = [], []\n    \tfor i in S: s = s + [i] if i != \'#\' else s[:-1]\n    \tfor i in T: t = t + [i] if i != \'#\' else t[:-1]\n    \treturn s == t\n\n\n```\n_Two-Pointer:_ (eight lines)\n```\nclass Solution:\n    def backspaceCompare(self, S: str, T: str) -> bool:\n    \ta, A = [[],[],0,0], [S,T]\n    \tfor i in range(2):\n    \t\tfor j in A[i][::-1]:\n    \t\t\tif j != \'#\':\n    \t\t\t\tif a[i+2] == 0: a[i].append(j)\n    \t\t\t\telse: a[i+2] -= 1\n    \t\t\telse: a[i+2] += 1\n    \treturn a[0] == a[1]\n\t\t\n\t\t\n\t\t\n- Junaid Mansuri\n(LeetCode ID)@hotmail.com
['Queue', 'Python', 'Python3']