3 ms·
my implementation: i = 0 for c in string.split(): i = i + len(c) + 1 if i <= 13: sys.stdout.write(c) sys.stdout.write(" ") else: sys.stdout.write(
by zaptheimpaler 15y ago
my implementation:
i = 0
for c in string.split():
i = i + len(c) + 1
if i <= 13:
sys.stdout.write(c)
sys.stdout.write(" ")
else:
sys.stdout.write('\n')
sys.stdout.write(c)
sys.stdout.write(" ")
i = len(c)
took me 10 minutes.
- thangalin 15y agoThis does not run in Python (NameError: name 'string' is not defined) -- the import statements are missing. And even when it does run, the output exceeds the maximum 8" bookmark length requirement. See my other reply. http://news.ycombinator.com/item?id=3882085 http://news.ycombinator.com/item?id=3882085