Store the frequency of the characters at even and odd indices
for i in range ( n ) : NEW_LINE INDENT if ( i % 2 == 0 ) : NEW_LINE INDENT if str [ i ] in freqEven : NEW_LINE INDENT freqEven [ str [ i ] ] += 1 NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if str [ i ] in freqOdd : NEW_LINE INDENT freqOdd [ str [ i ] ] += 1 NEW_LINE DEDENT DEDENT DEDENT