



from __future__ import annotations

class 		UpperCAmelCase__			:




			'''simple docstring'''






			def __init__(   self							: Union[str, Any]       ,       a_							: str       ,       a_							: str ):
					'''simple docstring'''





					__UpperCAmelCase							,					__UpperCAmelCase    :     int													=	text, pattern
					__UpperCAmelCase							,					__UpperCAmelCase    :     int													=	len(a_ ), len(a_ )




			def  snake_case__     (   self							: str       ,       a_							: str ):
					'''simple docstring'''





					for i in range(self.patLen - 1       ,       -1       ,       -1 ):
							if char == self.pattern[i]:
									return i
					return -1




			def  snake_case__     (   self							: List[Any]       ,       a_							: int ):
					'''simple docstring'''





					for i in range(self.patLen - 1       ,       -1       ,       -1 ):
							if self.pattern[i] != self.text[current_pos + i]:
									return current_pos + i
					return -1




			def  snake_case__     (   self							: Dict ):
					'''simple docstring'''





					__UpperCAmelCase    :     int													=	[]
					for i in range(self.textLen - self.patLen + 1 ):
							__UpperCAmelCase    :     List[Any]													=	self.mismatch_in_text(a_ )
							if mismatch_index == -1:
									positions.append(a_ )
							else:
									__UpperCAmelCase    :     Optional[int]													=	self.match_in_pattern(self.text[mismatch_index] )
									__UpperCAmelCase    :     Union[str, Any]													=	(
									    mismatch_index - match_index
									)  # shifting index lgtm [py/multiple-definition]
					return positions
__A   			="ABAABA"
__A   			="AB"
__A   			=BoyerMooreSearch(text, pattern)
__A   			=bms.bad_character_heuristic()

if len(positions) == 0:
				print("No match found")
else:
				print("Pattern found in following positions: ")
				print(positions)










from __future__ import annotations

class 		UpperCAmelCase__			:




			'''simple docstring'''






			def __init__(   self							: Optional[Any]       ,       a_							: Optional[int]=None ):
					'''simple docstring'''





					__UpperCAmelCase    :     Optional[Any]													=	data
					__UpperCAmelCase    :     Any													=	None




			def __repr__(   self							: Tuple ):
					'''simple docstring'''





					__UpperCAmelCase    :     Dict													=	[]
					__UpperCAmelCase    :     Any													=	self
					while temp:
							string_rep.append(F'{temp.data}' )
							__UpperCAmelCase    :     Dict													=	temp.next
					return "->".join(a_ )

def        a						(      _UpperCAmelCase							:					list						):







		'''simple docstring'''





		if not elements_list:
				raise Exception('''The Elements List is empty'''						)

		__UpperCAmelCase    :     int													=	Node(elements_list[0]						)
		for i in range(1 ,   len(_UpperCAmelCase						)						):
				__UpperCAmelCase    :     Any													=	Node(elements_list[i]						)
				__UpperCAmelCase    :     Optional[int]													=	current.next
		return head

def        a						(      _UpperCAmelCase							:					Node						):







		'''simple docstring'''





		if head_node is not None and isinstance(_UpperCAmelCase ,   _UpperCAmelCase						):
				print_reverse(head_node.next						)
				print(head_node.data						)

def        a						(      ):







		'''simple docstring'''





		from doctest import testmod

		testmod()

		__UpperCAmelCase    :     Tuple													=	make_linked_list([14, 52, 14, 12, 43]						)
		print('''Linked List:'''						)
		print(_UpperCAmelCase						)
		print('''Elements in Reverse:'''						)
		print_reverse(_UpperCAmelCase						)


if __name__ == "__main__":
				main()





