Medium · Strings

Number of Matching Subsequences

Given an ASCII string s and an array of non-empty ASCII words, return how many of the words are subsequences of s, counting duplicate words separately.

Examples

Example 1

s="abcde", words=[a,bb,acd,ace]

Output: 3 matching

Example 2

s="dsahjpjauf", words=[ahjpjau,ja,ahbwzgqnuk,tnmlanowax]

Output: 2 matching

Rebuild it in the studio

Open every published interview problem, solution, scene, and memory room free, with no account.

More Strings problems