



"""simple docstring"""





lowerCamelCase            =		{
    """meter""": """m""",
    """kilometer""": """km""",
    """megametre""": """Mm""",
    """gigametre""": """Gm""",
    """terametre""": """Tm""",
    """petametre""": """Pm""",
    """exametre""": """Em""",
    """zettametre""": """Zm""",
    """yottametre""": """Ym""",
}
# Exponent of the factor(meter)
lowerCamelCase            =		{
    """m""": 0,
    """km""": 3,
    """Mm""": 6,
    """Gm""": 9,
    """Tm""": 12,
    """Pm""": 15,
    """Em""": 18,
    """Zm""": 21,
    """Ym""": 24,
}
def      a__			(   lowerCAmelCase__			,    lowerCAmelCase__			,    lowerCAmelCase__   ):
      UpperCAmelCase_    				=							from_type.lower().strip("s"   )
      UpperCAmelCase_    				=							to_type.lower().strip("s"   )

      UpperCAmelCase_    				=							UNIT_SYMBOL.get(lowerCAmelCase__			,    lowerCAmelCase__   )
      UpperCAmelCase_    				=							UNIT_SYMBOL.get(lowerCAmelCase__			,    lowerCAmelCase__   )

      if from_sanitized not in METRIC_CONVERSION:
            UpperCAmelCase_    				=							(
                f"""Invalid 'from_type' value: {from_type!r}.\n"""
                f"""Conversion abbreviations are: {', '.join(lowerCAmelCase__   )}"""
            )
            raise ValueError(lowerCAmelCase__   )
      if to_sanitized not in METRIC_CONVERSION:
            UpperCAmelCase_    				=							(
                f"""Invalid 'to_type' value: {to_type!r}.\n"""
                f"""Conversion abbreviations are: {', '.join(lowerCAmelCase__   )}"""
            )
            raise ValueError(lowerCAmelCase__   )
      UpperCAmelCase_    				=							METRIC_CONVERSION[from_sanitized]
      UpperCAmelCase_    				=							METRIC_CONVERSION[to_sanitized]
      UpperCAmelCase_    				=							1

      if from_exponent > to_exponent:
            UpperCAmelCase_    				=							from_exponent - to_exponent
      else:
            UpperCAmelCase_    				=							-(to_exponent - from_exponent)

      return value * pow(10			,    lowerCAmelCase__   )


if __name__ == "__main__":
  from doctest import testmod

  testmod()









"""simple docstring"""





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

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

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

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

      return True


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




