To store frequency of 4 characters
let mp = new Map ( ) ; if ( mp . has ( A [ i ] ) ) mp . set ( A [ i ] , mp . get ( A [ i ] ) + 1 ) ; else mp . set ( A [ i ] , 1 ) ; if ( mp . has ( A [ n - i - 1 ] ) ) mp . set ( A [ n - i - 1 ] , mp . get ( A [ n - i - 1 ] ) + 1 ) ; else mp . set ( A [ n - i - 1 ] , 1 ) ; if ( mp . has ( B [ i ] ) ) mp . set ( B [ i ] , mp . get ( B [ i ] ) + 1 ) ; else mp . set ( B [ i ] , 1 ) ; if ( mp . has ( B [ n - i - 1 ] ) ) mp . set ( B [ n - i - 1 ] , mp . get ( B [ n - i - 1 ] ) + 1 ) ; else mp . set ( B [ n - i - 1 ] , 1 ) ; let sz = mp . size ;