Break a string with minimum cost