title: Find all values with maximum length in a dictionary
body: <p>I am writing an anagram program.  The user inputs the length of the word they want for example 11 then my program stores the sorted words in a dict key while the values are the anagrams stored in like in my sample ouput.  I only print the values with the largest set with most words for example in sample output its 3 words.  But if there is another value with 3 words i would like that to be printed also.</p>
  
  <p>Sample Output: Prints this only:</p>
  
  <pre><code>['activations', 'cavitations', 'vacationist']
  </code></pre>
  
  <p>but i also want: </p>
  
  <pre><code>['paternoster', 'penetrators', 'transportee']
  </code></pre>
  
  <p>Code</p>
  
  <pre><code>def main():
      wordList = readMatrix()
      sortDict = (lengthWord(wordList))
      maxSet = max(sortDict.values(), key = len)
      print(sorted(maxSet))
      for wor in sortDict.values():
          if len(maxSet) == len(sortDict.values()):
              print(sortDict.values())
  
  def readMatrix():
      wordList = []
      strFile = open("wordsEn.txt", "r")
      lines = strFile.readlines()
      for line in lines:
          word = line.rstrip().lower()
          wordList.append(word)
      return tuple(wordList)
  
  def lengthWord(wordList):
      lenWord = 11
      sortDict = {}
      wordList = readMatrix()
      for word in wordList:
          if len(word) == lenWord:
              sortWord = ''.join(sorted(word))
              if sortWord not in sortDict:
                  sortDict[sortWord] = set()
              sortDict[sortWord].add(word)
      return sortDict
  
  
  
  main()
  </code></pre>