You are given an array of strings words.
Let us define a boolean function isPrefixAndSuffix(str1, str2) that returns true if str1 is both a prefix and a suffix of str2, and false otherwise.
Return the total number of index pairs (i, j) such that isPrefixAndSuffix(words[i], words[j]) is true.
Constraints:
words.length
words[i].length
words[i] consists only of lowercase English letters.
The sum of the lengths of all words[i] does not exceed
You are given an array of strings words.
Let us define a boolean function isPrefixAndSuffix(str1, str2) that returns true if str1 is both a prefix and a suffix of str2, and false otherwise.
Return the total number of index pairs (i, j) such that isPrefixAndSuffix(words[i], words[j]) is true.
Constraints:
words.length
words[i].length
words[i] consists only of lowercase English letters.
The sum of the lengths of all words[i] does not exceed