423. Broken Keyboard
0
Easy
As an inexperienced gamer, you frequently lose in online games and often end up hitting your keyboard forcefully.
Now, you want to create a new account. However, you notice that many keys on your keyboard don't function properly. Consequently, you have to press them for an extended period of time. This issue causes a character to be typed one or more times.
You examine the characters that are typed on the keyboard. Output 'true' if it is possible that the typed characters represent your name, with some characters (possibly none) being long pressed. Otherwise, output 'false'.
Input Format
Two strings are provided: the correct name followed by the long pressed name.
Output Format
Output either 'true' or 'false', depending on whether the second string is the long pressed version of the correct name.
Example
Input
tushar
tuuushaarr
Output
true
Constraints
1 <= name.length(), typed.length() <= 1000
Both strings consist of only lowercase English letters.
Both strings consist of only lowercase English letters.
Loading...
View Submissions
Console