Loop to find longest subStrings from both ends which are reverse of each other
while ( i < j && s [ i ] === s [ j ] ) { i = i + 1 ; j = j - 1 ; } if ( i > 0 ) { A = s . substring ( 0 , i ) ; B = s . substring ( len - i , len ) ; }