Problem of the Day
A new programming or logic puzzle every Mon-Fri

Word Wrap

Today's goal is to create a basic word wrapping function. Your function will take in a string, font size, and width of screen. Your goal is to then print out the string line by line to fit within the width of the screen. If a word won't fit on a line, add a line break and move the entire word to that new line. For this problem assume the font is a monospace font so that all characters are of the same width.

Permalink: http://problemotd.com/problem/word-wrap/

Comments:

  • There are currently no comments. You can be first!

Content curated by @MaxBurstein