Personally, I really like the text tokenizer. I know that it’s not in style these days when the split is so simple and that’s it, but ...
(Psuedocode due to the high probability of homework)
create new string tokenizer using (" -") as separators
iterate for each token
if token is " "
return next token;
done.
source
share