I have a list that consists of events occurring on certain dates of certain months. To simplify, the list looks like this:
list = {{"June","19","a"},{"b"},{"c"},{"August","2","d"},{"e"}}
I would like to prepend the month and date elements to each succeeding element until a new date is encountered, so as to make:
res = {{"June","19","a"},{"June","19","b"},{"June","19","c"},{"August","2","d"},{"August","2","e"}}
...and so forth. I'd like to avoid DateObjects and just work with strings.
I would like to generalize the question, by allowing the list to contain variable numbers of elements following the month/day elements:
list = {{"June","19","a","a1"},{"b","b2","b3","b4"},{"c"},{"August","2","d"},{"e","e1}} to give:
res = {{"June","19","a","a1"},{"June","19","b","b2","b3","b4"},{"June","19","c"},{"August","2","d"},{"August","2","e","e1}}