#NEWLINE# def __build_result( self , dp , cur_index , cur_sentence , result ) : #NEWLINE# #INDENT# '\n        dfs recursive\n        ' #NEWLINE# if ( cur_index == 0 ) : #NEWLINE# #INDENT# result . append ( ' ' . join ( cur_sentence [ : : ( - 1 ) ] ) ) #NEWLINE# return #NEWLINE# #UNINDENT# for prefix in dp [ cur_index ] : #NEWLINE# #INDENT# self . __build_result ( dp , ( cur_index - len ( prefix ) ) , ( cur_sentence + [ prefix ] ) , result )