Description
Given two strings s and t, return true if they are equal when both are typed into empty text editors. The character # represents a backspace.
Examples
Input:
s = "ab#c", t = "ad#c"Output:
trueExplanation:
Both become "ac".
Input:
s = "ab##", t = "c#d#"Output:
trueExplanation:
After backspaces: "ab##" becomes "" and "c#d#" becomes "". Both are empty strings.
Input:
s = "a#c", t = "b"Output:
falseExplanation:
After backspaces: "a#c" becomes "c" and "b" stays "b". "c" != "b".
Constraints
- •
1 ≤ s.length, t.length ≤ 200