title: Repeating elements in list Python
body: <p>Let's say I have a list of strings:</p>
  
  <pre><code>a = ['a', 'a', 'b', 'c', 'c', 'c', 'd']
  </code></pre>
  
  <p>I want to make a list of items that appear at least twice in a row:</p>
  
  <pre><code>result = ['a', 'c']
  </code></pre>
  
  <p>I know I have to use a for loop, but I can't figure out how to target the items repeated in a row.
  How can I do so?</p>
  
  <p>EDIT: What if the same item repeats twice in a? Then the set function would be ineffective</p>
  
  <pre><code>a = ['a', 'b', 'a', 'a', 'c', 'a', 'a', 'a', 'd', 'd']
  result = ['a', 'a', 'd']
  </code></pre>