# Okay to post homework # Ryan Badi, April 28, 2024, Homework 26 read("ENGLISH.txt"): eng := ENG(): A := [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z]: freq := table([seq(seq([u_,v_]=0, v_ in A), u_ in A)]): for slength from 2 to 28 do: for word in eng[slength] do: for i_ from 1 to slength - 1 do: freq[[word[i_], word[i_ + 1]]] := freq[[word[i_], word[i_ + 1]]] + 1: od: od: od: counta := 0: countb := 0: countc := 0: for c_ in op(op(freq)) do: if rhs(c_) > 0 then: counta := counta + 1: if rhs(c_) > 9 then: countb := countb + 1: fi: fi: od: bigfreq := table([seq(seq(seq([u_,v_,w_]=0, w_ in A), v_ in A), u_ in A)]): for slength from 3 to 28 do: for word in eng[slength] do: for i_ from 1 to slength - 2 do: bigfreq[[word[i_], word[i_ + 1], word[i_ + 2]]] := bigfreq[[word[i_], word[i_ + 1], word[i_ + 2]]] + 1: od: od: od: for c_ in op(op(bigfreq)) do: if rhs(c_) > 0 then: countc := countc + 1: fi: od: printf("%a pairs of letters show up consecutively at least one time\n", counta): printf("%a pairs of letters show up consecutively at least ten times\n", countb): printf("%a trios of letters show up consecutively at least one time\n", countc):