title: Python - Find the number of duplicates in a string text
body: <p>I want to write a function that returns the number of alphabetic characters and numeric digits that occur more than once in an input string.</p>
  
  <p>Sample example: "aabbccd" should return 3 since "a","b" and "c" all have duplicates. Same for "aaabbccd", that would return 3 as well.</p>
  
  <p>Here is what I did, but it seems that there's something wrong with my code. It worked on some cases but apparently it does not on others.</p>
  
  <pre><code>def duplicate_count(text):
    count=0
    for i in range(len(text)-1):
        for j in range(i+1,len(text)):
            if text[i]==text[j]:
                count+=1
                break
        break
    return count
  </code></pre>