Your friend is typing their `name` on a keyboard. Sometimes a key gets long pressed, so its character is typed 1 or more extra times. Given `name` and the string `typed` that came out of the keyboard, return `true` if `typed` could be the friend's name with some characters (possibly none) long pressed.
Your friend is typing their name on a keyboard. Sometimes a key gets long pressed, so its character is typed 1 or more extra times. Given name and the string typed that came out of the keyboard, return true if typed could be the friend's name with some characters (possibly none) long pressed.
Example 1:
Input: {"name":"alex","typed":"aaleex"}
Output: true
Constraints:
1≤name.length,typed.length≤1000
name and typed consist of only lowercase English letters.
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"name":"alex","typed":"aaleex"}
i = 0 points at the next letter of name we expect, 'a'. j will walk the 6 typed keys from left to right.
name (i = next letter we expect; badge = times pressed)
i
a
1
l
2
e
3
x
typed keys (j walks them; small amber keys = held down)