1. 程式人生 > >Leetcode-925 Long Pressed Name(長按鍵入)

Leetcode-925 Long Pressed Name(長按鍵入)

按鍵 spa isl etc nbsp leet col als color

 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 };

Leetcode-925 Long Pressed Name(長按鍵入)