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
Output
5 1 4 3 0 -1
-1 1 4 3 0 5
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in