To traverse the character array and append it to new_str
for i in range ( 26 ) : NEW_LINE INDENT while ( arr [ i ] > 0 ) : NEW_LINE INDENT new_str += chr ( i + ord ( ' a ' ) ) NEW_LINE arr [ i ] -= 1 NEW_LINE DEDENT DEDENT return new_str NEW_LINE