← Back to challenges

Sticky Keys Typing

JavaScriptHardconditionslogicstringsvalidation

Instructions

Someone is typing on the sticky keyboard. Occasionally a key gets stuck and more than intended number of characters of a particular letter is being added into the string. The function input contains original and typed strings. Determine if the typed string has been made from the original. Return true if it is and false if the typed string cannot have been made from the original.

Examples

isLongPressed("alex", "aaleex") ➞ true

isLongPressed("saeed", "ssaaedd") ➞ false

isLongPressed("leelee", "lleeelee") ➞ true

isLongPressed("Tokyo", "TTokkyoh") ➞ false

isLongPressed("laiden", "laiden") ➞ true

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.