Counting possible tuples on a list
How about
Partition[l, 2, 1] // Counts
(*
<|{"A", "A"} -> 5, {"A", "E"} -> 1, {"E", "D"} -> 2, {"D", "D"} ->
3, {"D", "C"} -> 1, {"C", "B"} -> 1, {"B", "E"} -> 2, {"E", "E"} ->
2, {"D", "B"} -> 2, {"B", "A"} -> 1, {"A", "D"} -> 2, {"E", "C"} ->
1, {"C", "A"} -> 1, {"D", "A"} -> 1, {"A", "C"} -> 1, {"C", "C"} ->
2, {"C", "D"} -> 1, {"D", "E"} -> 1|>
*)
You can also use SequenceCases
+ Counts
:
Counts[SequenceCases[l, {_, _}, Overlaps -> True]]
<|{"A", "A"} -> 5, {"A", "E"} -> 1, {"E", "D"} -> 2, {"D", "D"} -> 3, {"D", "C"} -> 1, {"C", "B"} -> 1, {"B", "E"} -> 2, {"E", "E"} -> 2, {"D", "B"} -> 2, {"B", "A"} -> 1, {"A", "D"} -> 2, {"E", "C"} -> 1, {"C", "A"} -> 1, {"D", "A"} -> 1, {"A", "C"} -> 1, {"C", "C"} -> 2, {"C", "D"} -> 1, {"D", "E"} -> 1|>