There are some excellent string splitter functions you can search for on this site (Jeff Moden's is the one most recommended for speed and flexibility). Any of these would be good illustrations of the concepts you need to solve your exercises. Posting what you have tried so far will allow the folks here to steer you in the right direction without doing the work for you. Most folks here balk at providing the complete answer for these types of exercises because it tends to minimize the actual amount of knowledge gained by the requestor.
And then again, I might be wrong ...