
f = {
    "a": 8.167,
    "b": 1.492,
    "c": 2.782,
    "d": 4.253,
    "e": 12.702,
    "f": 2.228,
    "g": 2.015,
    "h": 6.094,
    "i": 6.966,
    "j": 0.153,
    "k": 0.772,
    "l": 4.025,
    "m": 2.406,
    "n": 6.749,
    "o": 7.507,
    "p": 1.929,
    "q": 0.095,
    "r": 5.987,
    "s": 6.327,
    "t": 9.056,
    "u": 2.758,
    "v": 0.978,
    "w": 2.360,
    "x": 0.150,
    "y": 1.974,
    "z": 0.074
}

for w in open('dict.txt'):
  if (
    (w[2] == 'h' or w[3] == 'h') and 
    (w[0] == 't' or w[1] == 't' or w[4] == 't') and 
    'a' not in w and 'c' not in w and 's' not in w and 'm' not in w and
    'o' not in w and 'n' not in w and 'u' not in w and 'e' not in w 
  ):
    w = w.strip()
    weight = 0
    c_counts = {c: w.count(c) for c in set(w)}
    for c in c_counts:
      weight += f[c]
    print (round(weight,3),w)
