Find the even length palindrome with center points as i - 1 and i .
while ( l >= 0 && r < n && s . charAt ( l ) == s . charAt ( r ) ) { ans2 += s . charAt ( l ) ; l -- ; r ++ ; } v . add ( ans1 ) ; v . add ( ans2 ) ; } String ans = v . get ( 0 ) ;