Skip to content

Practice Long Pressed Name

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#925
LeetCode Problem

Long Pressed Name

Problem Statement

Your friend is typing his name into a keyboard. Sometimes, when typing a character c, the key might get long pressed, and the character will be typed 1 or more times. You examine the typed characters of the keyboard. Return True if it is possible that it was your friends name, with some characters (possibly none) being long pressed.

Source: Long Pressed Name on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
name = "alex", typed = "aaleex"
Output
true

# Example 2

Input
name = "saeed", typed = "ssaaedd"
Output
false

Constraints

1 <= name.length, typed.length <= 1000
name and typed consist of only lowercase English letters.

Related LeetCode Problems

Practice more problems similar to Long Pressed Name.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.