drafts. The user has typed the query query. A draft matches if query begins with it exactly (including when the draft equals the whole query).
Return the number of matching drafts. Repeated drafts each count separately.drafts=["c", "ca", "cat", "cab", "at"], query="cats" → 3
The query "cats" starts with "c", "ca" and "cat". "cab" differs at the third letter, and "at" is not at the start.
drafts=["go", "go"], query="go" → 2
Identical drafts each count separately, and a word is a start of itself.
drafts=["longer"], query="long" → 0
The draft is longer than the query, so it cannot be its start.
drafts=["c", "ca", "cat", "cab", "at"], query="cats"
3
Run checks the first 3 tests in your browser. Submit checks all 147 tests on the server, hidden ones included.