


'''simple docstring'''
from __future__ import annotations


def 			_lowercase       (				UpperCamelCase__       :					list,				UpperCamelCase__       :					int,				UpperCamelCase__       :					int,				UpperCamelCase__       :					int			):
   __A  :		Dict       =			[]
   __A  :		Dict       =			input_list[low:mid], input_list[mid : high + 1]
   while left and right:
      result.append((left if left[0] <= right[0] else right).pop(0			)			)
   __A  :		Optional[Any]       =			result + left + right
   return input_list


def 			_lowercase       (				UpperCamelCase__       :					list			):
   if len(UpperCamelCase__			) <= 1:
      return input_list
   __A  :		Any       =			list(UpperCamelCase__			)

   # iteration for two-way merging
   __A  :		Dict       =			2
   while p <= len(UpperCamelCase__			):
      # getting low, high and middle value for merge-sort of single list
      for i in range(0,				len(UpperCamelCase__			),				UpperCamelCase__			):
         __A  :		Union[str, Any]       =			i
         __A  :		Tuple       =			i + p - 1
         __A  :		Union[str, Any]       =			(low + high + 1) // 2
         __A  :		Tuple       =			merge(UpperCamelCase__,				UpperCamelCase__,				UpperCamelCase__,				UpperCamelCase__			)
      # final merge of last two parts
      if p * 2 >= len(UpperCamelCase__			):
         __A  :		Optional[int]       =			i
         __A  :		str       =			merge(UpperCamelCase__,				0,				UpperCamelCase__,				len(UpperCamelCase__			) - 1			)
         break
      p *= 2

   return input_list


if __name__ == "__main__":
 UpperCAmelCase_ :     Any								=      input('Enter numbers separated by a comma:\n').strip()
 if user_input == "":
  UpperCAmelCase_ :     Union[str, Any]								=      []
 else:
  UpperCAmelCase_ :     str								=      [int(item.strip()) for item in user_input.split(',')]
 print(iter_merge_sort(unsorted))










'''simple docstring'''
from __future__ import annotations


def 			_lowercase       (				UpperCamelCase__       :					list,				UpperCamelCase__       :					int,				UpperCamelCase__       :					int,				UpperCamelCase__       :					int			):
 __A  :		Dict       =			[]
 __A     ,__A  :		Dict       =			input_list[low:mid], input_list[mid : high + 1]
 while left and right:
  result.append((left if left[0] <= right[0] else right).pop(0			)			)
 __A  :		Optional[Any]       =			result + left + right
 return input_list


def 			_lowercase       (				UpperCamelCase__       :					list			):
 if len(UpperCamelCase__			) <= 1:
  return input_list
 __A  :		Any       =			list(UpperCamelCase__			)

 # iteration for two-way merging
 __A  :		Dict       =			2
 while p <= len(UpperCamelCase__			):
  # getting low, high and middle value for merge-sort of single list
  for i in range(0,				len(UpperCamelCase__			),				UpperCamelCase__			):
   __A  :		Union[str, Any]       =			i
   __A  :		Tuple       =			i + p - 1
   __A  :		Union[str, Any]       =			(low + high + 1) // 2
   __A  :		Tuple       =			merge(UpperCamelCase__,				UpperCamelCase__,				UpperCamelCase__,				UpperCamelCase__			)
  # final merge of last two parts
  if p * 2 >= len(UpperCamelCase__			):
   __A  :		Optional[int]       =			i
   __A  :		str       =			merge(UpperCamelCase__,				0,				UpperCamelCase__,				len(UpperCamelCase__			) - 1			)
   break
  p *= 2

 return input_list


if __name__ == "__main__":
 UpperCAmelCase_ :     Any								=      input('Enter numbers separated by a comma:\n').strip()
 if user_input == "":
  UpperCAmelCase_ :     Union[str, Any]								=      []
 else:
  UpperCAmelCase_ :     str								=      [int(item.strip()) for item in user_input.split(',')]
 print(iter_merge_sort(unsorted))






