Sticky Keys Typing

Published by Deep Xavier in

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("leellee", "lleeelee") ➞ false

isLongPressed("deep", "dddeeeppp") ➞ true

isLongPressed("teshaa", "ttteeeesssshhhaaaaa") ➞ true

isLongPressed("xavier", "xavvviieerr") ➞ true

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

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

Notes

N/A

Watch a quick demo on how Edabit works.