





import PIL.Image
import PIL.ImageOps
from packaging import version
from PIL import Image


if version.parse(version.parse(PIL.__version__).base_version) >= version.parse("""9.1.0"""):
     UpperCAmelCase	:	str		     =       {
         """linear""": PIL.Image.Resampling.BILINEAR,
         """bilinear""": PIL.Image.Resampling.BILINEAR,
         """bicubic""": PIL.Image.Resampling.BICUBIC,
         """lanczos""": PIL.Image.Resampling.LANCZOS,
         """nearest""": PIL.Image.Resampling.NEAREST,
     }
else:
     UpperCAmelCase	:	Tuple		     =       {
         """linear""": PIL.Image.LINEAR,
         """bilinear""": PIL.Image.BILINEAR,
         """bicubic""": PIL.Image.BICUBIC,
         """lanczos""": PIL.Image.LANCZOS,
         """nearest""": PIL.Image.NEAREST,
     }
def      _A       (		SCREAMING_SNAKE_CASE     :   List[Any]						):





  """simple docstring"""



  a__	:					Tuple										=(images / 2 + 0.5).clamp(0       ,       1						)
  a__	:					Any										=images.cpu().permute(0       ,       2       ,       3       ,       1						).float().numpy()
  a__	:					Optional[Any]										=numpy_to_pil(SCREAMING_SNAKE_CASE						)
  return images





def      _A       (		SCREAMING_SNAKE_CASE     :   Dict						):





  """simple docstring"""



  if images.ndim == 3:
    a__	:					int										=images[None, ...]
  a__	:					List[str]										=(images * 255).round().astype("uint8"						)
  if images.shape[-1] == 1:
    # special case for grayscale (single channel) images
    a__	:					Optional[int]										=[Image.fromarray(image.squeeze()       ,       mode="L"						) for image in images]
  else:
    a__	:					List[Any]										=[Image.fromarray(SCREAMING_SNAKE_CASE						) for image in images]

  return pil_images













def      _A       (		SCREAMING_SNAKE_CASE     :   Optional[Any]						):





  """simple docstring"""



  a__	:					Optional[Any]										=len(SCREAMING_SNAKE_CASE						)
  while cur > 1:
    # Find the maximum number in arr
    a__	:					List[Any]										=arr.index(max(arr[0:cur]						)						)
    # Reverse from 0 to mi
    a__	:					int										=arr[mi::-1] + arr[mi + 1 : len(SCREAMING_SNAKE_CASE						)]
    # Reverse whole list
    a__	:					List[str]										=arr[cur - 1 :: -1] + arr[cur : len(SCREAMING_SNAKE_CASE						)]
    cur -= 1
  return arr


if __name__ == "__main__":
     UpperCAmelCase	:	int		     =       input("""Enter numbers separated by a comma:\n""").strip()
     UpperCAmelCase	:	Optional[int]		     =       [int(item) for item in user_input.split(""",""")]
     print(pancake_sort(unsorted))






