In this case, using Table[]
and Sum[]
instead of Map[]
makes for less confusing code:
Table[Sum[SequenceCount[s, {g}], {g, group}], {s, subseq}]
Alternatively, you can use a single Table[]
and apply Total[]
afterwards:
Total[Table[SequenceCount[s, {g}], {s, subseq}, {g, group}], {2}]