List of text

Hello, I have a simple problem in grasshopper but I can’t figure out the solution.

Basically i want to go from something like this:
image
and transform it to something like this:
image

where I want to be in control of the lenght of the list.
Is there a way of doing this in grasshopper or can someone give me some tips to make a python script that does this?