"""simple docstring"""


from __future__ import annotations


class 				a :


    def __init__(    self		:     Union[str, Any]      , __lowerCAmelCase		:     str      , __lowerCAmelCase		:     str    ):
      _UpperCAmelCase         =					text, pattern
      _UpperCAmelCase         =					len(snake_case_    ), len(snake_case_    )


    def    lowerCAmelCase_     (    self		:     List[Any]      , __lowerCAmelCase		:     str    ):

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


    def    lowerCAmelCase_     (    self		:     Dict      , __lowerCAmelCase		:     int    ):

      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    lowerCAmelCase_     (    self		:     int    ):
      # searches pattern in text and returns index positions
      _UpperCAmelCase         =					[]
      for i in range(self.textLen - self.patLen + 1    ):
        _UpperCAmelCase         =					self.mismatch_in_text(snake_case_    )
        if mismatch_index == -1:
          positions.append(snake_case_    )
        else:
          _UpperCAmelCase         =					self.match_in_pattern(self.text[mismatch_index]    )
          _UpperCAmelCase         =					(
              mismatch_index - match_index
          )  # shifting index lgtm [py/multiple-definition]
      return positions



UpperCAmelCase__     						=  """ABAABA"""
UpperCAmelCase__     						=  """AB"""
UpperCAmelCase__     						=  BoyerMooreSearch(text, pattern)
UpperCAmelCase__     						=  bms.bad_character_heuristic()

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


def    __UpperCamelCase     (				lowerCAmelCase__							:				str  ,   lowerCAmelCase__							:				str  ):
 __a :  str						=  len(lowerCAmelCase__  )
 __a :  Optional[int]						=  []
 for i in range(len(lowerCAmelCase__  ) - pat_len + 1  ):
  __a :  str						=  True
  for j in range(lowerCAmelCase__  ):
   if s[i + j] != pattern[j]:
    __a :  Tuple						=  False
    break
  if match_found:
   position.append(lowerCAmelCase__  )
 return position


if __name__ == "__main__":
      assert naive_pattern_search('ABCDEFG', 'DE') == [3]
      print(naive_pattern_search('ABAAABCDBBABCDDEBCABC', 'ABC'))
