Take s = "aab" and word "aab". Groups of s: (a,2), (b,1). Groups of word: (a,2), (b,1). Every group matches with equal counts. The word is stretchy.
Now try word "ab". Groups: (a,1), (b,1). Compare first group: s has a's, word has . The counts differ, and , so you can't stretch. Not stretchy.
For each word of length , grouping takes and comparison takes . With words, total time is where is the length of s. Space is for storing groups.