class Solution:
def isLongPressedName(self, name: str, typed: str) -> bool:
m, n = len(name), len(typed)
if n < m:
return False
i = j = 0
while j < n:
if i < m and name[i] == typed[j]:
i += 1
j += 1
elif j > 0 and typed[j] == typed[j-1]:
j += 1
else:
return False
return i == m
长按键入-模拟925-python
于 2022-05-05 16:07:36 首次发布