~/algor $ cat problems/massiv-nolga-tenglashtirish
Zeroing between min and max
Easy
1000 ms
128 MB
32%
A positive integer $n$ and an array of $n$ distinct integers ($n \ge 3$) are given. Replace with $0$ all elements located between the smallest and the largest elements (the smallest and the largest elements themselves do not change) and print the array.
Input
The first line contains a positive integer $n$. The second line contains $n$ distinct integers separated by spaces.
Output
One line with $n$ integers separated by spaces.
Note
$3 \le n \le 1000$
$-10^{9} \le a_{i} \le 10^{9}$
Examples
Input #1
7 12 3 8 14 5 20 7
Output #1
12 3 0 0 0 20 7
Input #2
4 10 1 5 2
Output #2
10 1 5 2