Text Justification Using Dynamic Programming