s/byte/char; Factor out little helper method.
No need to buffer line, just write out words. No need to buffer words next.