Autogram

Autograms are sentences that describes themselves in the sense of providing an inventory of their characters. As a result, they are also called self-enumerating or self-documenting sentences.

this sentence contains two a’s, one b, three c’s, one d, thirty-four e’s, five f’s, three g’s, nine h’s, eleven i’s, one j, one k, two l’s, one m, twenty-two n’s, sixteen o’s, one p, one q, eight r’s, twenty-nine s’s, twenty-three t’s, three u’s, four v’s, eight w’s, two x’s, five y’s, one z.

I have written a small Python script (100 lines) using PyTorch to generate the above sentence.

I am curious to know how you would solve the problem, what would be your solution.