I have a list in a array, each entry either contains o: or g: in front of a word, like o:word or g:word. I want 2 functions, one to make an array with just the g:'s and one to make an array with just the o:'s

I also want the g:'s and o:'s to be pruned out of the result. I'm not sure how to do this without causing array out of bounds errors and such, so I was wondering if someone could give me an example.