






'''simple docstring'''





class 					lowercase							:


    '''simple docstring'''

    def __init__(       self  :  Optional[int]					,  __lowerCamelCase  :  Optional[int]  )				->				List[str]:

     '''simple docstring'''




     lowerCamelCase__	=  data
     lowerCamelCase__	=  None
     lowerCamelCase__	=  None




    def __str__(       self  :  int  )				->				str:

     '''simple docstring'''




     return f'''{self.data}'''
class 					lowercase							:


    '''simple docstring'''

    def __init__(       self  :  List[Any]  )				->				int:

     '''simple docstring'''




     lowerCamelCase__	=  None
     lowerCamelCase__	=  None

    def __iter__(       self  :  List[Any]  )				->				List[str]:

     '''simple docstring'''




     lowerCamelCase__	=  self.head
     while node:
      yield node.data
      lowerCamelCase__	=  node.next

    def __str__(       self  :  List[str]  )				->				Union[str, Any]:

     '''simple docstring'''




     return "->".join([str(__SCREAMING_SNAKE_CASE  ) for item in self]  )

    def __len__(       self  :  Optional[int]  )				->				Union[str, Any]:

     '''simple docstring'''




     return sum(1 for _ in self  )

    def  a__					(       self  :  Tuple					,  __lowerCamelCase  :  Tuple  )				->				Any:

     '''simple docstring'''




     self.insert_at_nth(0					,  __SCREAMING_SNAKE_CASE  )

    def  a__					(       self  :  List[Any]					,  __lowerCamelCase  :  Union[str, Any]  )				->				Tuple:

     '''simple docstring'''




     self.insert_at_nth(len(self  )					,  __SCREAMING_SNAKE_CASE  )

    def  a__					(       self  :  int					,  __lowerCamelCase  :  List[str]					,  __lowerCamelCase  :  Union[str, Any]  )				->				List[Any]:

     '''simple docstring'''




     lowerCamelCase__	=  len(self  )

     if not 0 <= index <= length:
      raise IndexError("list index out of range"  )
     lowerCamelCase__	=  Node(__SCREAMING_SNAKE_CASE  )
     if self.head is None:
      lowerCamelCase__	=  new_node
     elif index == 0:
      lowerCamelCase__	=  new_node
      lowerCamelCase__	=  self.head
      lowerCamelCase__	=  new_node
     elif index == length:
      lowerCamelCase__	=  new_node
      lowerCamelCase__	=  self.tail
      lowerCamelCase__	=  new_node
     else:
      lowerCamelCase__	=  self.head
      for _ in range(0					,  __SCREAMING_SNAKE_CASE  ):
       lowerCamelCase__	=  temp.next
      lowerCamelCase__	=  new_node
      lowerCamelCase__	=  temp.previous
      lowerCamelCase__	=  temp
      lowerCamelCase__	=  new_node

    def  a__					(       self  :  str  )				->				Union[str, Any]:

     '''simple docstring'''




     return self.delete_at_nth(0  )

    def  a__					(       self  :  Optional[int]  )				->				List[str]:

     '''simple docstring'''




     return self.delete_at_nth(len(self  ) - 1  )

    def  a__					(       self  :  Any					,  __lowerCamelCase  :  int  )				->				Any:

     '''simple docstring'''




     lowerCamelCase__	=  len(self  )

     if not 0 <= index <= length - 1:
      raise IndexError("list index out of range"  )
     lowerCamelCase__	=  self.head  # default first node
     if length == 1:
      lowerCamelCase__	=  None
     elif index == 0:
      lowerCamelCase__	=  self.head.next
      lowerCamelCase__	=  None
     elif index == length - 1:
      lowerCamelCase__	=  self.tail
      lowerCamelCase__	=  self.tail.previous
      lowerCamelCase__	=  None
     else:
      lowerCamelCase__	=  self.head
      for _ in range(0					,  __SCREAMING_SNAKE_CASE  ):
       lowerCamelCase__	=  temp.next
      lowerCamelCase__	=  temp
      lowerCamelCase__	=  temp.previous
      lowerCamelCase__	=  temp.next
     return delete_node.data

    def  a__					(       self  :  int					,  __lowerCamelCase  :  List[Any]  )				->				Tuple:

     '''simple docstring'''




     lowerCamelCase__	=  self.head

     while current.data != data:  # Find the position to delete
      if current.next:
       lowerCamelCase__	=  current.next
      else:  # We have reached the end an no value matches
       raise ValueError("No data matching given value"  )

     if current == self.head:
      self.delete_head()

     elif current == self.tail:
      self.delete_tail()

     else:  # Before: 1 <--> 2(current) <--> 3
      lowerCamelCase__	=  current.next  # 1 --> 3
      lowerCamelCase__	=  current.previous  # 1 <--> 3
     return data




    def  a__					(       self  :  str  )				->				int:

     '''simple docstring'''




     return len(self  ) == 0






def  lowerCamelCase_  (     ):
 lowerCamelCase__	=  DoublyLinkedList()
 assert linked_list.is_empty() is True
 assert str(SCREAMING_SNAKE_CASE_) == ""

 try:
  linked_list.delete_head()
  raise AssertionError  # This should not happen.
 except IndexError:
  assert True  # This should happen.

 try:
  linked_list.delete_tail()
  raise AssertionError  # This should not happen.
 except IndexError:
  assert True  # This should happen.

 for i in range(10):
  assert len(SCREAMING_SNAKE_CASE_) == i
  linked_list.insert_at_nth(SCREAMING_SNAKE_CASE_					,  i + 1)
 assert str(SCREAMING_SNAKE_CASE_) == "->".join(str(SCREAMING_SNAKE_CASE_) for i in range(1					,  11))

 linked_list.insert_at_head(0)
 linked_list.insert_at_tail(11)
 assert str(SCREAMING_SNAKE_CASE_) == "->".join(str(SCREAMING_SNAKE_CASE_) for i in range(0					,  12))

 assert linked_list.delete_head() == 0
 assert linked_list.delete_at_nth(9) == 10
 assert linked_list.delete_tail() == 11
 assert len(SCREAMING_SNAKE_CASE_) == 9
 assert str(SCREAMING_SNAKE_CASE_) == "->".join(str(SCREAMING_SNAKE_CASE_) for i in range(1					,  10))


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

 testmod()





def   a						(				SCREAMING_SNAKE_CASE_   :		Any							):






       """simple docstring"""





       UpperCamelCase     :						int 						=		len(SCREAMING_SNAKE_CASE_							)
       for i in range(length - 1							):
              UpperCamelCase     :						Optional[int] 						=		False
              for j in range(length - 1 - i							):
                     if collection[j] > collection[j + 1]:
                            UpperCamelCase     :						Optional[int] 						=		True
                            UpperCamelCase						,			UpperCamelCase     :						Union[str, Any] 						=		collection[j + 1], collection[j]
              if not swapped:
                     break  # Stop iteration if the collection is sorted.
       return collection


if __name__ == "__main__":
  import doctest
  import time

  doctest.testmod()

  __UpperCAmelCase			:			Any			      =					input("Enter numbers separated by a comma:").strip()
  __UpperCAmelCase			:			List[str]			      =					[int(item) for item in user_input.split(",")]
  __UpperCAmelCase			:			List[Any]			      =					time.process_time()
  print(*bubble_sort(unsorted), sep=",")
  print(f'''Processing time: {(time.process_time() - start)%1E9 + 7}''')

