human
Count of lines required to write the given String | Function to return the number of lines required.
If string is empty.
Initialize lines and width.
Iterate through S.
Return lines and width used.
Driver Code.
Function call to print required answer"
How can the above be solved in Python?
 Write me a code to count of lines required to write the given String and the other steps required?
assistant
#Here is code to count of lines required to write the given String and the other steps required.
 def numberOfLines ( S , widths ) :
	if ( S == " " ) :
		return 0 , 0
	lines , width = 1 , 0
	for c in S :
		w = widths [ ord ( c ) - ord ( ' a ' ) ]
		width += w
		if width > 10 :
			lines += 1
			width = w
	return lines , width
S = " bbbcccdddaa "
Widths = [ 4 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ]
print ( numberOfLines ( S , Widths ) )