Medium · Strings

Number of Matching Subsequences

Given a string s and an array of non-empty 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

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More Strings problems