in reply to array splitting

Can you show us what you have so far? It might be easier to fix the code you've written than to write you a solution from scratch.