swap min & max

Given a list of numbers on a single line, your task is to find the minimum and the maximum in the list and swap their places.
The program should output the resulting list after the swap.
Input
5 1 4 3 0 -1

Output
-1 1 4 3 0 5
 
To check your solution you need to sign in
Sign in to continue