Number of Matching Subsequences

Given a source string s and an array of words, return how many words are subsequences of s. Each word is counted independently, including duplicate entries.

  • Input: s = "abcde", words = ["a", "bb", "acd", "ace"]
  • Output: 3
Examples
Input: ["a"]
Output: 1
Hints

Number of Matching Subsequences

Given a source string `s` and an array of `words`, return how many words are subsequences of `s`. Each word is counted independently, including duplicate entries.