Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
For each string from words calculate the leading count and store it in an array, then sort the integer array.
For each string from queries calculate the leading count "p" and in base of the sorted array calculated on the step 1 do a binary search to count the number of items greater than "p".