title: “Is there a way to get sequence of most consecutive alphabet?”
body: <p>I am working on a python problem which has a string such as “aaabbcc” and a number n (integer). 
  I have to display a sequence of any Alphabetic character that appears exactly n times.</p>
  
  <p>I have tried the code</p>
  
  <pre><code>import collections
  str1 = 'aaabbcc'
  d = collections.defaultdict(int)
  for c in str1:
      d[c] += 1
  
  for c in sorted(d, key=d.get, reverse=True):
    if d[c] &gt; 1:
        print(c, d[c])
  </code></pre>
  
  <p>But I am getting output as </p>
  
  <pre><code>a 3
  b 2
  c 2
  </code></pre>
  
  <p>I am expecting output as the integer input <code>3</code> is input is taken, from user. </p>
  
  <pre><code>integer= 3 
  sequence= aaa
  </code></pre>
  
  <p>Is there any alternative solution?</p>