wrap_text(text, width) that wraps a single-line string text into multiple lines, each at most width characters long, breaking only at spaces (never splitting a word), and returns the result as one string with lines joined by \n. Assume no single word exceeds width characters.wrap_text("the quick brown fox jumps", 10)'the quick\nbrown fox\njumps'
Words are packed greedily without exceeding 10 characters per line.
wrap_text("hi", 10)'hi'
Fits on one line.
Iterate words, tracking the current line; when adding the next word would exceed width, start a new line.
Watch the "would this line + word (plus a space) exceed width" check carefully for the first word on a line.