Input: s = "ab#c", t = "ad#c"
Output: true
Explanation: Both s and t become "ac".
Input: s = "ab##", t = "c#d#"
Output: true
Explanation: Both s and t become "".
조건
1 <= s.length, t.length <= 200
s and t only contain lowercase letters and '#' characters.
class Solution:
def backspaceCompare(self, s: str, t: str) -> bool:
def process(s):
s_lst = []
for i in s:
if i == "#":
if s_lst != []:
s_lst.pop()
else:
s_lst.append(i)
return s_lst
return process(s) == process(t)