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