You are given a 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 i j and isPrefixAndSuffix(words[i], words[j]) is true.
Constraints:
words.length
words[i].length
words[i] consists only of lowercase English letters.
You are given a 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 i j and isPrefixAndSuffix(words[i], words[j]) is true.
Constraints:
words.length
words[i].length
words[i] consists only of lowercase English letters.