Function to print the number of characters having odd frequencies for each query
function queryResult ( prefix , Q ) { let l = Q [ 0 ] ; let r = Q [ 1 ] ; if ( l == 0 ) { let xorval = prefix [ r ] ; document . write ( countSetBits ( xorval ) + " " ) ; } else { let xorval = prefix [ r ] ^ prefix [ l - 1 ] ; document . write ( countSetBits ( xorval ) + " " ) ; } }