title: Counting the frequency of a character until a new character is introduced - python
body: <p>I was writing a program to count the frequency of alphabets based on the user input until &quot;!&quot; was introduced. The following is my program:</p>
  <pre><code>list1=[] 
  
  character = &quot;&quot; 
  while character != '!' :
        character = input()
        list1.append(character)
  
  result=[]
  for alphabet in ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] :
       if list1.count(alphabet) &gt; 0:
              result.append(alphabet)
              result.append(list1.count(alphabet))
  
   print(result)
  </code></pre>
  <p>However, apparently, I should have counted the frequency until a new character has been plugged in the input.
  For instance, if the input is (aabc), then my program should count the two 'a's then move on to 'b'.</p>
  <p>Is there anyway for me to modify my loop to count the frequency before moving on to a new alphabet?</p>