Count substrings of a given string whose anagram is a palindrome | Function to print count of subStrings whose anagrams are palindromic ; Stores the answer ; Iterate over the String ; Set the current character ; Parity update ; Print the final count ; Driver Code ; Function Call
function countSubString ( s ) { let res = 0 ; for ( let i = 0 ; i < s . length ; i ++ ) { let x = 0 ; for ( let j = i ; j < s . length ; j ++ ) { let temp = 1 << s [ j ] - ' ' ; x ^= temp ; if ( ( x & ( x - 1 ) ) == 0 ) res ++ ; } } document . write ( res ) ; } let str = " " ; countSubString ( str ) ;