
s = 'hello there my name is jeff'

# count the frequency of letters in s
# 'h' : 1, 'e' : 5, 'j': 1, etc.

counts = {} # {'h': 1, 'e': 5, 'j': 1}

for letter in s:
  #print(letter)  # letter is 'e'
  counts[letter] = counts.setdefault(letter, 0) + 1

print(counts)

# who cares about frequency counts? 
#  fun excercises... 
#   author identification (old stuff that we don't know who wrote it).
#    also check for AI
#   encryption breaking easy substitution ciphers

# 'hello world'
# +1
# 'igmmp xpsme'

# count the frequency of the encrypted letters.
#  whatever is most common is probably 'e' or 't' or 'h'
#  https://pi.math.cornell.edu/~mec/2003-2004/cryptography/subs/frequencies.html
# look for double letters (ll, oo, ...)

# Note - could also count words instead of letters, could also 
#        check pairs of words ('hello there', 'there my', 'my name', ...)
