If you want a hint…
The way I did it – there may well be better – I just kept track of the number of each pair. You don’t need to know the order. You do, however need the first and last letter.
Then each generation – each Pair – for example NN becomes the same number of the two new pairs.
After all your generations – add how many of each letter you have, add the end ones, then divide by 2 to get the actual numbers (pairs double count all the letters except the end ones – but you’ve added those).
Now you have a (in my case) Map N -> 1234, C -> 4321, etc.
Edit – reading that, not sure it makes much sense.