You are given a list of strings (comma-separated). A pair (i, j) is counted if i < j and words[i] is both a prefix and a suffix of words[j].
Return the total count of such valid pairs.
Input: Comma-separated list of strings.
Output: An integer — the count of valid (i,j) pairs.
Input: a,aba,ababa,aa
Output: 4
Explanation: Valid pairs: (a,aba),(a,ababa),(a,aa),(aba,ababa).Input: pa,papa,mamama,ma
Output: 2
Explanation: (pa,papa) and (ma,mamama) are valid.Input: abab,ab
Output: 0
Explanation: i<j required; 'ab'(j=1) doesn't include 'abab'(i=0) as prefix+suffix.1 <= words.length <= 501 <= words[i].length <= 10words[i] consists of lowercase English letters