


'''simple docstring'''


class 						lowerCAmelCase__      :






			class 						lowerCAmelCase__      :
						lowerCAmelCase			:						Tuple							 =  "_prev", "_data", "_next"




						def __init__(		self	:  List[str]						,	lowerCamelCase__	:  Dict						,	lowerCamelCase__	:  Union[str, Any]						,	lowerCamelCase__	:  Union[str, Any]			) ->int:



								'''simple docstring'''







								_UpperCAmelCase		:							Optional[Any]             =   link_p
								_UpperCAmelCase		:							List[str]             =   element
								_UpperCAmelCase		:							Dict             =   link_n






						def 				lowerCAmelCase__     (		self	:  Tuple			) ->Optional[int]:



								'''simple docstring'''







								return (
								    F""" Prev -> {self._prev is not None}, Next -> {self._next is not None}"""
								)




			def __init__(		self	:  str			) ->Optional[int]:



					'''simple docstring'''







					_UpperCAmelCase		:							Dict             =   self._Node(lowerCamelCase__						,	lowerCamelCase__						,	lowerCamelCase__			)
					_UpperCAmelCase		:							Any             =   self._Node(lowerCamelCase__						,	lowerCamelCase__						,	lowerCamelCase__			)
					_UpperCAmelCase		:							Optional[Any]             =   self._trailer
					_UpperCAmelCase		:							str             =   self._header
					_UpperCAmelCase		:							List[str]             =   0




			def __len__(		self	:  Optional[Any]			) ->int:



					'''simple docstring'''







					return self._size




			def 				lowerCAmelCase__     (		self	:  int			) ->Optional[Any]:



					'''simple docstring'''







					return self.__len__() == 0




			def 				lowerCAmelCase__     (		self	:  str						,	lowerCamelCase__	:  Optional[int]						,	lowerCamelCase__	:  Dict						,	lowerCamelCase__	:  str			) ->Dict:



					'''simple docstring'''







					_UpperCAmelCase		:							Tuple             =   self._Node(lowerCamelCase__						,	lowerCamelCase__						,	lowerCamelCase__			)
					_UpperCAmelCase		:							str             =   new_node
					_UpperCAmelCase		:							Optional[int]             =   new_node
					self._size += 1
					return self






			def 				lowerCAmelCase__     (		self	:  str						,	lowerCamelCase__	:  Optional[Any]			) ->Optional[int]:



					'''simple docstring'''







					_UpperCAmelCase		:							Optional[int]             =   node._prev
					_UpperCAmelCase		:							Optional[Any]             =   node._next

					_UpperCAmelCase		:							Optional[int]             =   successor
					_UpperCAmelCase		:							List[Any]             =   predecessor
					self._size -= 1
					_UpperCAmelCase		:							Optional[Any]             =   node._data
					_UpperCAmelCase		:							str             =   None
					del node
					return temp






class 						lowerCAmelCase__      (      _DoublyLinkedBase						):




			def 				lowerCAmelCase__     (		self	:  Optional[int]			) ->str:



					'''simple docstring'''







					if self.is_empty():
							raise Exception("List is empty"			)
					return self._header._next._data




			def 				lowerCAmelCase__     (		self	:  str			) ->Any:



					'''simple docstring'''







					if self.is_empty():
							raise Exception("List is empty"			)
					return self._trailer._prev._data




			def 				lowerCAmelCase__     (		self	:  str						,	lowerCamelCase__	:  Any			) ->List[Any]:



					'''simple docstring'''







					return self._insert(self._header						,	lowerCamelCase__						,	self._header._next			)




			def 				lowerCAmelCase__     (		self	:  int						,	lowerCamelCase__	:  Tuple			) ->str:



					'''simple docstring'''







					return self._insert(self._trailer._prev						,	lowerCamelCase__						,	self._trailer			)




			def 				lowerCAmelCase__     (		self	:  Any			) ->List[Any]:



					'''simple docstring'''







					if self.is_empty():
							raise IndexError("remove_first from empty list"			)
					return self._delete(self._header._next			)






			def 				lowerCAmelCase__     (		self	:  int			) ->str:



					'''simple docstring'''







					if self.is_empty():
							raise IndexError("remove_first from empty list"			)
					return self._delete(self._trailer._prev			)




def       a__      (					a  ,   a  ,   a  ,   a  ,   a  ,   a  ,   )		->	tuple[list[list[int]], list[list[str]]]:
       A_							:       Optional[Any]	      =				list(a							)
       A_							:       int	      =				list(a							)
       A_							:       Union[str, Any]	      =				len(a							)
       A_							:       Any	      =				len(a							)

       A_							:       Union[str, Any]	      =				[
           [0 for _ in range(len_destination_seq + 1							)] for _ in range(len_source_seq + 1							)
       ]
       A_							:       Optional[int]	      =				[
           ['''0''' for _ in range(len_destination_seq + 1							)] for _ in range(len_source_seq + 1							)
       ]

       for i in range(1  ,   len_source_seq + 1							):
              A_							:       List[Any]	      =				i * delete_cost
              A_							:       List[Any]	      =				f"""D{source_seq[i - 1]:c}"""

       for i in range(1  ,   len_destination_seq + 1							):
              A_							:       Optional[Any]	      =				i * insert_cost
              A_							:       str	      =				f"""I{destination_seq[i - 1]:c}"""

       for i in range(1  ,   len_source_seq + 1							):
              for j in range(1  ,   len_destination_seq + 1							):
                     if source_seq[i - 1] == destination_seq[j - 1]:
                            A_							:       List[Any]	      =				costs[i - 1][j - 1] + copy_cost
                            A_							:       Tuple	      =				f"""C{source_seq[i - 1]:c}"""
                     else:
                            A_							:       Union[str, Any]	      =				costs[i - 1][j - 1] + replace_cost
                            A_							:       Dict	      =				f"""R{source_seq[i - 1]:c}""" + str(destination_seq[j - 1]							)

                     if costs[i - 1][j] + delete_cost < costs[i][j]:
                            A_							:       Dict	      =				costs[i - 1][j] + delete_cost
                            A_							:       Optional[int]	      =				f"""D{source_seq[i - 1]:c}"""

                     if costs[i][j - 1] + insert_cost < costs[i][j]:
                            A_							:       List[Any]	      =				costs[i][j - 1] + insert_cost
                            A_							:       Tuple	      =				f"""I{destination_seq[j - 1]:c}"""

       return costs, ops


def       a__      (					a  ,   a  ,   a							)		->	list[str]:
       if i == 0 and j == 0:
              return []
       else:
              if ops[i][j][0] == "C" or ops[i][j][0] == "R":
                     A_							:       Tuple	      =				assemble_transformation(a  ,   i - 1  ,   j - 1							)
                     seq.append(ops[i][j]							)
                     return seq
              elif ops[i][j][0] == "D":
                     A_							:       Any	      =				assemble_transformation(a  ,   i - 1  ,   a							)
                     seq.append(ops[i][j]							)
                     return seq
              else:
                     A_							:       Tuple	      =				assemble_transformation(a  ,   a  ,   j - 1							)
                     seq.append(ops[i][j]							)
                     return seq


if __name__ == "__main__":
    _lowerCAmelCase  ,			_lowerCAmelCase        =       compute_transform_tables('Python', 'Algorithms', -1, 1, 2, 2)

    _lowerCAmelCase        =       len(operations)
    _lowerCAmelCase        =       len(operations[0])
    _lowerCAmelCase        =       assemble_transformation(operations, m - 1, n - 1)

    _lowerCAmelCase        =       list('Python')
    _lowerCAmelCase        =       0
    _lowerCAmelCase        =       0

    with open('min_cost.txt', 'w') as file:
        for op in sequence:
            print(''.join(string))

            if op[0] == "C":
                file.write('%-16s' % 'Copy %c' % op[1])
                file.write('\t\t\t' + ''.join(string))
                file.write('\r\n')

                cost -= 1
            elif op[0] == "R":
                _lowerCAmelCase        =       op[2]

                file.write('%-16s' % ('Replace %c' % op[1] + ' with ' + str(op[2])))
                file.write('\t\t' + ''.join(string))
                file.write('\r\n')

                cost += 1
            elif op[0] == "D":
                string.pop(i)

                file.write('%-16s' % 'Delete %c' % op[1])
                file.write('\t\t\t' + ''.join(string))
                file.write('\r\n')

                cost += 2
            else:
                string.insert(i, op[1])

                file.write('%-16s' % 'Insert %c' % op[1])
                file.write('\t\t\t' + ''.join(string))
                file.write('\r\n')

                cost += 2

            i += 1

        print(''.join(string))
        print('Cost: ', cost)

        file.write('\r\nMinimum cost: ' + str(cost))


