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:true
Explanation:

Both become "ac".

Input:s = "ab##", t = "c#d#"
Output:true
Explanation:

After backspaces: "ab##" becomes "" and "c#d#" becomes "". Both are empty strings.

Input:s = "a#c", t = "b"
Output:false
Explanation:

After backspaces: "a#c" becomes "c" and "b" stays "b". "c" != "b".

Constraints

  • 1 ≤ s.length, t.length ≤ 200

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!