All pastes #2092924 Raw Edit

Miscellany

public text v1 · immutable
#2092924 ·published 2011-11-08 04:28 UTC
rendered paste body
inp = "Welcome to CCC have a nice day".split(' ')
l = int(raw_input("Enter a width: "))
count = 0
stor = ''
star = []

for i in inp:
	count += 1
	if (len(stor) + len(i)) < l:
			stor += i + '.'
			
	elif (len(stor) + len(i)) == l:
			stor += i
			
	else: 
		while len(stor) < l:
			stor += '.'
		star.append(stor)
		stor = ''
		if (len(stor) + len(i)) < l:
			stor += i + '.'
			
		elif (len(stor) + len(i)) == l:
			stor += i	
				
	if count == len(inp):
		while len(stor) < l:
			stor += '.'
			
	if len(stor) == l:
		star.append(stor)
		stor = ''

for i in star:
	print i
pause = raw_input ("press any key to exit ")