I have
strings = ["aaa", "bb", "ccc", "ddd", "e", "ff", "rrrrrrrr", "tttttttt", "a"]
I want to group the strings in the array so that each element is no longer then 5 and not shorter then 9. The strings have to maintain their order in the array.
EDIT: Sorry for confusion, yes – at least 5 and at most 9.
the outcome I am looking for is:
result = ["aaabbbccc", "dddeff", "rrrrrrrr", "tttttttta"]
Since your question was specified in a rather confusing way, this is the best I could come up with.