'''simple docstring'''






def  _SCREAMING_SNAKE_CASE		(      __snake_case							:			Dict				):
     if not head:
          return True
     # split the list to two parts
     _A		,       _A    		=  head.next, head
     while fast and fast.next:
          _A    		=  fast.next.next
          _A    		=  slow.next
     _A    		=  slow.next
     _A    		=  None  # Don't forget here! But forget still works!
     # reverse the second part
     _A    		=  None
     while second:
          _A    		=  second.next
          _A    		=  node
          _A    		=  second
          _A    		=  nxt
     # compare two parts
     # second part has the same or one less node
     while node:
          if node.val != head.val:
               return False
          _A    		=  node.next
          _A    		=  head.next
     return True





def  _SCREAMING_SNAKE_CASE		(      __snake_case							:			List[str]				):
     if not head or not head.next:
          return True

     # 1. Get the midpoint (slow)
     _A    		=  _A    		=  _A    		=  head
     while fast and fast.next:
          _A		,       _A    		=  fast.next.next, slow.next

     # 2. Push the second half into the stack
     _A    		=  [slow.val]
     while slow.next:
          _A    		=  slow.next
          stack.append(slow.val				)

     # 3. Comparison
     while stack:
          if stack.pop() != cur.val:
               return False
          _A    		=  cur.next

     return True





def  _SCREAMING_SNAKE_CASE		(      __snake_case							:			List[str]				):
     if not head or not head.next:
          return True
     _A    		=  {}
     _A    		=  0
     while head:
          if head.val in d:
               d[head.val].append(__snake_case				)
          else:
               _A    		=  [pos]
          _A    		=  head.next
          pos += 1
     _A    		=  pos - 1
     _A    		=  0
     for v in d.values():
          if len(__snake_case				) % 2 != 0:
               middle += 1
          else:
               _A    		=  0
               for i in range(0   ,		len(__snake_case				)				):
                    if v[i] + v[len(__snake_case				) - 1 - step] != checksum:
                         return False
                    step += 1
          if middle > 1:
               return False
     return True




'''simple docstring'''






def  _SCREAMING_SNAKE_CASE		(      __snake_case							:			str   ,		__snake_case							:			str   ,		__snake_case							:			List[Any]=False				):

     if isinstance(__snake_case   ,		__snake_case				) and isinstance(__snake_case   ,		__snake_case				):
          _A    		=  len(set_a.intersection(__snake_case				)				)

          if alternative_union:
               _A    		=  len(__snake_case				) + len(__snake_case				)
          else:
               _A    		=  len(set_a.union(__snake_case				)				)

          return intersection / union

     if isinstance(__snake_case   ,		(list, tuple)				) and isinstance(__snake_case   ,		(list, tuple)				):
          _A    		=  [element for element in set_a if element in set_b]

          if alternative_union:
               _A    		=  len(__snake_case				) + len(__snake_case				)
               return len(__snake_case				) / union
          else:
               _A    		=  set_a + [element for element in set_b if element not in set_a]
               return len(__snake_case				) / len(__snake_case				)

          return len(__snake_case				) / len(__snake_case				)
     return None


if __name__ == "__main__":
   _UpperCAmelCase    :     Optional[Any]         =       {'''a''', '''b''', '''c''', '''d''', '''e'''}
   _UpperCAmelCase    :     str         =       {'''c''', '''d''', '''e''', '''f''', '''h''', '''i'''}
   print(jaccard_similarity(set_a, set_b))



