Store the frequency of the characters at even and odd indices
for ( var i = 0 ; i < n ; i ++ ) { if ( i % 2 === 0 ) { freqEven [ str [ i ] . charCodeAt ( 0 ) ] ++ ; } else { freqOdd [ str [ i ] . charCodeAt ( 0 ) ] ++ ; } }