Video Solution
By Jeffrey Meng
Video Solution Code
Explanation
This section is not complete.
Any help would be appreciated! Just submit a Pull Request on GitHub.
Editorial
Implementation
Time Complexity:
with open("word.in") as read:max_width = int(read.readline().split()[1])essay = read.readline().split()formatted = ""rn_length = 0for w in essay:# ok, this word exceeds the limit, let's wrap it aroundif rn_length + len(w) > max_width:formatted = formatted[:-1] + "\n"
Join the USACO Forum!
Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!