Company: Amazon_23july
Difficulty: medium
Word Conjugates Problem Description Amazon has introduced a tool to explore the world of "Word Conjugates", allowing users to analyze strings consisting only of the characters 'a' , 'b' , 'c' and 'd' . The concept of conjugates follows a pairing mechanism where 'a' pairs with 'b' , 'c' pairs with 'd' , and vice-versa. As a result, there are only four valid conjugate pairs: ('a', 'b') , ('b', 'a') , ('c', 'd') and ('d', 'c') . Two strings s and t of the same length n are conjugates if, for every index i ( 0 <= i < n ), the pair formed by the characters at that index, (s[i], t[i]) , is a conjugate pair. A string is valid if there exists a permutation of the string such that the original string and that permutation are conjugates of each other. Given a string s that contains only the characters 'a' , 'b' , 'c' and 'd' , return the total number of valid substrings of s . Complete the function getConjugatePairs , which takes the string s and returns the number of valid substrings of s