class        lowerCamelCase__				:





			def __init__(       self	:	Optional[Any]						):
										_lowerCAmelCase							=							''
										_lowerCAmelCase							=							''
										_lowerCAmelCase							=							[]





			def   SCREAMING_SNAKE_CASE__     (       self	:	Dict  ,  lowercase__	:	int  ,  lowercase__	:	int						):
										if m == -1:
																	return n + 1
										elif n == -1:
																	return m + 1
										elif self.dp[m][n] > -1:
																	return self.dp[m][n]
										else:
																	if self.worda[m] == self.worda[n]:
																								_lowerCAmelCase							=							self.__min_dist_top_down_dp(m - 1  ,  n - 1						)
																	else:
																								_lowerCAmelCase							=							self.__min_dist_top_down_dp(lowercase__  ,  n - 1						)
																								_lowerCAmelCase							=							self.__min_dist_top_down_dp(m - 1  ,  lowercase__						)
																								_lowerCAmelCase							=							self.__min_dist_top_down_dp(m - 1  ,  n - 1						)
																								_lowerCAmelCase							=							1 + min(lowercase__  ,  lowercase__  ,  lowercase__						)

																	return self.dp[m][n]





			def   SCREAMING_SNAKE_CASE__     (       self	:	Optional[Any]  ,  lowercase__	:	str  ,  lowercase__	:	str						):
										_lowerCAmelCase							=							worda
										_lowerCAmelCase							=							worda
										_lowerCAmelCase							=							[[-1 for _ in range(len(lowercase__						)						)] for _ in range(len(lowercase__						)						)]

										return self.__min_dist_top_down_dp(len(lowercase__						) - 1  ,  len(lowercase__						) - 1						)





			def   SCREAMING_SNAKE_CASE__     (       self	:	str  ,  lowercase__	:	str  ,  lowercase__	:	str						):
										_lowerCAmelCase							=							worda
										_lowerCAmelCase							=							worda
										_lowerCAmelCase							=							len(lowercase__						)
										_lowerCAmelCase							=							len(lowercase__						)
										_lowerCAmelCase							=							[[0 for _ in range(n + 1						)] for _ in range(m + 1						)]

										for i in range(m + 1						):
																	for j in range(n + 1						):
																								if i == 0:  # first string is empty
																															_lowerCAmelCase							=							j
																								elif j == 0:  # second string is empty
																															_lowerCAmelCase							=							i
																								elif worda[i - 1] == worda[j - 1]:  # last characters are equal
																															_lowerCAmelCase							=							self.dp[i - 1][j - 1]
																								else:
																															_lowerCAmelCase							=							self.dp[i][j - 1]
																															_lowerCAmelCase							=							self.dp[i - 1][j]
																															_lowerCAmelCase							=							self.dp[i - 1][j - 1]
																															_lowerCAmelCase							=							1 + min(lowercase__  ,  lowercase__  ,  lowercase__						)
										return self.dp[m][n]


if __name__ == "__main__":
				_lowercase:	Any       			=		EditDistance()

				print('''****************** Testing Edit Distance DP Algorithm ******************''')
				print()

				_lowercase:	Any       			=		input('''Enter the first string: ''').strip()
				_lowercase:	Optional[Any]       			=		input('''Enter the second string: ''').strip()

				print()
				print(f"""The minimum edit distance is: {solver.min_dist_top_down(Sa, Sa)}""")
				print(f"""The minimum edit distance is: {solver.min_dist_bottom_up(Sa, Sa)}""")
				print()
				print('''*************** End of Testing Edit Distance DP Algorithm ***************''')







from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


_lowercase:	Optional[Any]       			=		{
    '''configuration_rag''': ['''RagConfig'''],
    '''retrieval_rag''': ['''RagRetriever'''],
    '''tokenization_rag''': ['''RagTokenizer'''],
}

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				_lowercase:	Optional[Any]       			=		[
				    '''RagModel''',
				    '''RagPreTrainedModel''',
				    '''RagSequenceForGeneration''',
				    '''RagTokenForGeneration''',
				]

try:
				if not is_tf_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				_lowercase:	Optional[Any]       			=		[
				    '''TFRagModel''',
				    '''TFRagPreTrainedModel''',
				    '''TFRagSequenceForGeneration''',
				    '''TFRagTokenForGeneration''',
				]


if TYPE_CHECKING:
				from .configuration_rag import RagConfig
				from .retrieval_rag import RagRetriever
				from .tokenization_rag import RagTokenizer

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_rag import RagModel, RagPreTrainedModel, RagSequenceForGeneration, RagTokenForGeneration

				try:
								if not is_tf_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_tf_rag import (
								    TFRagModel,
								    TFRagPreTrainedModel,
								    TFRagSequenceForGeneration,
								    TFRagTokenForGeneration,
								)

else:
				import sys

				_lowercase:	Optional[int]       			=		_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)






