






"""simple docstring"""



def      _lowerCAmelCase		(							UpperCAmelCase__       :					int      )		->list:

						# bit count represents no. of bits in the gray code
						if bit_count < 0:
												raise ValueError("""The given input must be positive"""      )

						# get the generated string sequence
						A__						:  Any		  =  gray_code_sequence_string(UpperCAmelCase__      )
						#
						# convert them to integers
						for i in range(len(UpperCAmelCase__      )      ):
												A__						:  List[Any]		  =  int(sequence[i],						2      )

						return sequence




def      _lowerCAmelCase		(							UpperCAmelCase__       :					int      )		->list:

						# The approach is a recursive one
						# Base case achieved when either n = 0 or n=1
						if bit_count == 0:
												return ["0"]

						if bit_count == 1:
												return ["0", "1"]

						A__						:  Any		  =  1 << bit_count  # defines the length of the sequence
						# 1<< n is equivalent to 2^n

						# recursive answer will generate answer for n-1 bits
						A__						:  Tuple		  =  gray_code_sequence_string(bit_count - 1      )

						A__						:  List[Any]		  =  []

						# append 0 to first half of the smaller sequence generated
						for i in range(seq_len // 2      ):
												A__						:  str		  =  """0""" + smaller_sequence[i]
												sequence.append(UpperCAmelCase__      )

						# append 1 to second half ... start from the end of the list
						for i in reversed(range(seq_len // 2      )      ):
												A__						:  Tuple		  =  """1""" + smaller_sequence[i]
												sequence.append(UpperCAmelCase__      )

						return sequence


if __name__ == "__main__":
						import doctest

						doctest.testmod()














"""simple docstring"""



from __future__ import annotations






class 							__SCREAMING_SNAKE_CASE						:


							def __init__(			self      :						Any			,    snake_case      :						str			,    snake_case      :						str							):
													'''simple docstring'''





													A__  ,  A__						:  List[str]		  =  text, pattern
													A__  ,  A__						:  List[str]		  =  len(snake_case							), len(snake_case							)


							def 						_UpperCamelCase       (			self      :						str			,    snake_case      :						str							):
													'''simple docstring'''





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


							def 						_UpperCamelCase       (			self      :						Any			,    snake_case      :						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 						_UpperCamelCase       (			self      :						Union[str, Any]							):
													'''simple docstring'''





													A__						:  str		  =  []
													for i in range(self.textLen - self.patLen + 1							):
																			A__						:  List[Any]		  =  self.mismatch_in_text(snake_case							)
																			if mismatch_index == -1:
																									positions.append(snake_case							)
																			else:
																									A__						:  Dict		  =  self.match_in_pattern(self.text[mismatch_index]							)
																									A__						:  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)






