Tap here to switch tabs
Problem
Submissions

Problem: Expressive Words

med
30 min
Try to solve the Expressive Words problem.

Statement

Given a string s and an array of strings words, determine how many strings in words are stretchy.

A query string can be stretched to match s by extending groups of consecutive identical characters. A character group in the query word can be extended if the corresponding group in s has a length of at least 33 and is not shorter than the group in the query word. If the group in s has a length less than 33, the group in the query word must match its length exactly without extension.

Return the total number of words in words that can be stretched to form s.

Constraints:

  • 1≤1 \leq s.length, words.length ≤100\leq 100

  • 1≤1 \leq words[i].length ≤100\leq 100

  • s and words[i] consist of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Expressive Words

med
30 min
Try to solve the Expressive Words problem.

Statement

Given a string s and an array of strings words, determine how many strings in words are stretchy.

A query string can be stretched to match s by extending groups of consecutive identical characters. A character group in the query word can be extended if the corresponding group in s has a length of at least 33 and is not shorter than the group in the query word. If the group in s has a length less than 33, the group in the query word must match its length exactly without extension.

Return the total number of words in words that can be stretched to form s.

Constraints:

  • 1≤1 \leq s.length, words.length ≤100\leq 100

  • 1≤1 \leq words[i].length ≤100\leq 100

  • s and words[i] consist of lowercase English letters.