Loop to find the frequencies subsequence of length 2
for ( var i = 0 ; i < n ; i ++ ) { for ( var j = i + 1 ; j < n ; j ++ ) { var temp = " " ; temp += s [ i ] ; temp += s [ j ] ; if ( freq . has ( temp ) ) freq . set ( temp , freq . get ( temp ) + 1 ) else freq . set ( temp , 1 ) } } var answer = - 1000000000 ;