Function to find anagram of string such that characters at the same indices are different
function swap ( str , i , j ) { if ( i == j ) { return str ; } if ( j < i ) { var temp = j ; j = i ; i = temp ; } if ( i >= str . length ) { return str ; } return str . substring ( 0 , i ) + str [ j ] + str . substring ( i + 1 , j ) + str [ i ] + str . substring ( j + 1 ) ; } function findAnagram ( s ) {