题目
长按键入
题目链接
官方题解
关键词
双指针
代码记录
class Solution:
def isLongPressedName(self, name: str, typed: str) -> bool:
i=0
j=0
while j<len(typed):
if i<len(name) 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==len(name)