Counting duplicate characters in Python string : I can't figure out why always the last character in a string gets omitted when I try the below. 



        def duplicate_count(text):
            num = 0
            count = {}
            for char in text:
                print(count.items())
                if char in count.keys():
                    count[char] += 1
                else:
                    count [char] = 1
            for key in count:
                if count[key] == 1:
                   num = 0
                else:
                   num = count[key] - 1
            return (num)
    char_s = 'abcde'
    print (duplicate_count(char_s))