Wrote the line splitting function to split a string across multiple lines without breaking a word.