Problem Challenge: Suffix Score

Solve a problem to test and practice your knowledge and understanding of suffix searching.

Problem statement

Given an array of words of non-empty strings, return an array answer of the same size, where answer[i] is the sum of scores of every non-empty suffix of words[i].

The score of a string word is the number of string words[i] such that the word is a suffix of words[i]. Please note that a string is a suffix of itself.

Example 1

Sample input

Get hands-on with 1400+ tech skills courses.