human
How to print maximum number of A 's using given four keys | this function returns the optimal length string for N keystrokes.
The optimal string length is N when N is smaller than 7.
An array to store result of subproblems.
Initializing the optimal lengths array for uptil 6 input strokes ..
Solve all subproblems in bottom manner.
Initialize length of optimal string for n keystrokes.
For any keystroke n , we need to loop from n - 3 keystrokes back to 1 keystroke to find a breakpoint ' b ' after which we will have ctrl - a , ctrl - c and then only ctrl - v all the way ..
if the breakpoint is at b 'th keystroke then  the optimal string would have length  (n-b-1)*screen[b-1];.
Driver program.
for the rest of the array we will rely on the previous entries to compute new ones"
Solution in Python:
assistant
#Here is code to how to print maximum number of A 's using given four keys and the other steps required.
 def findoptimal ( N ) :
	if ( N <= 6 ) :
		return N
	screen = [ 0 ] * N
	for n in range ( 1 , 7 ) :
		screen [ n - 1 ] = n
	for n in range ( 7 , N + 1 ) :
		screen [ n - 1 ] = 0
		for b in range ( n - 3 , 0 , - 1 ) :
			curr = ( n - b - 1 ) * screen [ b - 1 ]
			if ( curr > screen [ n - 1 ] ) :
				screen [ n - 1 ] = curr
	return screen [ N - 1 ]
if __name__ == " _ _ main _ _ " :
	for N in range ( 1 , 21 ) :
		print ( " Maximum ▁ Number ▁ of ▁ A ' s ▁ with ▁ " , N , " ▁ keystrokes ▁ is ▁ " , findoptimal ( N ) )