Skip to content

Instantly share code, notes, and snippets.

@bamboo
Created April 23, 2012 18:36
Show Gist options
  • Save bamboo/2472945 to your computer and use it in GitHub Desktop.
Save bamboo/2472945 to your computer and use it in GitHub Desktop.
import System
// http://blog.8thlight.com/uncle-bob/2012/04/20/Why-Is-Estimating-So-Hard.html
// estimated to take 5, done in 4 ;)
text = """
Four score and seven years ago our fathers brought forth upon this continent a new nation, conceived in liberty and dedicated to the proposition that all men are created equal…
"""
words = /\s+/.Split(text.Trim())
currentLineLength = 0
for word in words:
if currentLineLength > 0:
if currentLineLength + 1 + len(word) > 13:
currentLineLength = 0
Console.WriteLine()
else:
Console.Write(" ")
currentLineLength += 1
Console.Write(word)
currentLineLength += len(word)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment