3926. Count Valid Word Occurrences
You are given an array of strings
chunks. Concatenate all strings inchunksin order to form a strings.You are also given an array of strings
queries.A joiner hyphen is a hyphen character
'-'inswhose previous and next characters both exist and are lowercase English letters.A word is a maximal substring of
sconsisting only of lowercase English letters and joiner hyphens.All other characters, including spaces and hyphens that are not joiner hyphens, are treated as separators.
Return an integer array
ans, whereans[i]is the number of timesqueries[i]appears as a word ins.
1 | class Solution { |