Function to print the number of characters having odd frequencies for each query
def queryResult ( prefix , Q ) : NEW_LINE INDENT l = Q [ 0 ] NEW_LINE r = Q [ 1 ] NEW_LINE if ( l == 0 ) : NEW_LINE INDENT xorval = prefix [ r ] NEW_LINE print ( bin ( xorval ) . count ( '1' ) ) NEW_LINE DEDENT else : NEW_LINE INDENT xorval = prefix [ r ] ^ prefix [ l - 1 ] NEW_LINE print ( bin ( xorval ) . count ( '1' ) ) NEW_LINE DEDENT DEDENT