title: how to find max. relative frequency in string, python?
body: <p>How to find max. relative frequency in string? The function which takes a string argument and returns the highest relative frequency of any letter in the string. For example, the string 'sufficit' has 8 letters, and the most frequent letters are f and i, which both occur twice. Thus, the highest relative frequency is 2/8. The string 'Non-even' has 7 letters (- is not a letter), and the most frequent letter is n which occurs three times (one N and two n). Thus, the highest relative frequency is 3/7.</p>
  
  <pre><code>def max_rel_freq(string):
      dic = {}
      total = float(len(string))
      for ch in string:
          if ch in dic:
              dic[ch] = dic[ch] + 1
          else:
              dic[ch] = 1
  
      frequencies = []
      for s in string:
          frequencies.append(float(dic[s]/total))
      return max(frequencies)
  </code></pre>
  
  <p>This works for only 'sufficit' but does not give required output for 'Non-even'.</p>