Don't like this style? Click here to change it! blue.css

Lab 5: Crypt-analysis

If you are breaking a code, like an old school Caesar-cipher, then you'll want to know how common each letter is, how common each pair of letters is, and how common each triplet of letters is.

      
        lzrxogolnhbrxdoowrehfrphvxshusrzhuhg
      
    

The above letters make the phrase "I would like you all to become super powered" but where each letter is shifted forward by three in the alphabet.

Your Mission:

Write a function which consumes a string (likely containing encrypted plaintext) and produces two dictionaries:

Please ignore all whitespace and non-alphabetical characters.

An example:

If my function had the name ngram:

      
        ngram("banana man") ==
        ({"b":1, a":4, "n":3, "m":1},
        {"ba":1, "an":3, "na":2, "am":1, "ma":1})