#Nuray Kutlu #OK TO POST read `ENGLISH.txt`: #You get 593 pairs CountPairs:= proc() local PS, allW, I1,J,K ,pair: allW:=ENG(): PS:={}: for I1 from 1 to nops(allW) do: for J from 1 to nops(allW[I1]) do: for K from 1 to nops(allW[I1][J]) do: if K<>nops(allW[I1][J]) then pair:=[allW[I1][J][K], allW[I1][J][K+1]]: PS:= PS union {pair}: fi: od: od: od: return nops(PS): end: # You get 497 pairs that show up more than 10 times CountPairsCommon:= proc() local alph, PT, allW, I1,J,K, ct: ct:=0: allW:=ENG(): alph:= [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]: for I1 from 1 to 26 do for J from 1 to 26 do PT[alph[I1],alph[J]] := 0: od: od: for I1 from 1 to nops(allW) do: for J from 1 to nops(allW[I1]) do: for K from 1 to nops(allW[I1][J]) do: if K<>nops(allW[I1][J]) then PT[allW[I1][J][K], allW[I1][J][K+1]] := PT[allW[I1][J][K], allW[I1][J][K+1]] +1: fi: od: od: od: for I1 from 1 to 26 do for J from 1 to 26 do if PT[alph[I1],alph[J]]>10 then ct:=ct+1: fi: od: od: ct: end: # You get 6639 triplets TripletCount:=proc() local PS, allW, I1,J,K , triple: allW:=ENG(): PS:={}: for I1 from 1 to nops(allW) do: for J from 1 to nops(allW[I1]) do: for K from 1 to (nops(allW[I1][J])-2) do: triple:=[allW[I1][J][K], allW[I1][J][K+1], allW[I1][J][K+2]]: PS:= PS union {triple}: od: od: od: return nops(PS): end: