Question #247140

A data compression software utilizes various steps to compress a string of data. One of the steps involves finding the count of characters that are not repeated in the string. Write an algorithm for the software developer to find the count of characters that are not repeated in the string.

Expert's answer

def not_repeated_chars_count(our_string):
    my_dict = {}
    for ch in our_string:
        my_dict[ch] = my_dict.setdefault(ch, 0) + 1
    my_list = [x for x in my_dict if my_dict[x] == 1]
    return len(my_list)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS