Leetcode-925 Long Pressed Name(长按键入)

 1 class Solution
 2 {
 3     public://saeed ssaaedd
 4         bool isLongPressedName(string name, string typed)
 5         {
 6             int typedEnd = 0;
 7             for(int i = 0;i < name.size();i ++)
 8             {
 9                 while(typedEnd < typed.size() && name[i]!=typed[typedEnd])
10                     typedEnd ++;
11                     
12                 if(typedEnd >= typed.size())
13                     return false;
14                 
15                 typedEnd ++;
16             }
17             return true;
18         }
19 };

 

posted @ 2018-10-23 18:32  Asurudo  阅读(169)  评论(0编辑  收藏  举报