title: Exclude runs of the same element from itertools.product
body: <p>I have the following code: </p>
  
  <pre><code>possible_keys = map(lambda combo: ''.join(combo), itertools.product(LETTERS, repeat=key_len))
  </code></pre>
  
  <p>It generates all the possible combinations in the alphabet based on the key length I'm passing it. For example, if I pass in 2, it will generate aa, ab, ac, and so on. If I pass in 3, it will generate aaa, aab, aac, and so on.</p>
  
  <p>I would like to optimize my code a little better by removing instances where the string is all the same letters, e.g. aaa, bbbb, ccccccc. Essentially, removing the diagonals if this was a matrix. How can I accomplish that with this or if there a better way?</p>
  
  <p><strong>EDIT</strong>: I'm working on the Vigenere Cipher by dictionary attack. I didn't want to reveal big problem I was working on because I was afraid people would give answers to that instead haha. Though, now any suggestions welcomed :)  This is my first iteration of my program so it's really inefficient because I'm going through all possible keys and matching it with what's in the dictionary provided.. </p>