Initializing vector to store count of strings .
counts = [ ] NEW_LINE for i in range ( 5 ) : NEW_LINE INDENT counts . append ( 1 ) NEW_LINE DEDENT for i in range ( 2 , N + 1 ) : NEW_LINE INDENT for j in range ( 3 , - 1 , - 1 ) : NEW_LINE INDENT counts [ j ] += counts [ j + 1 ] NEW_LINE DEDENT DEDENT ans = 0 NEW_LINE