Google interview question

I was asked to solve a programming challenge about paragraph justification