Competitions
PERLA CONTEST 7 DIV2_2
Neighbors of the same sign
Array of n integers is given. Print the pairs of adjacent elements of the same sign. If there are no adjacent elements of the same sign, print nothing.
Input
First line contains number n. Next line contains n integers. All numbers do not exceed 100 by absolute value.
Output
Print the pairs of adjacent elements of the same sign.
Input example #1
7 9 5 -7 -7 5 -9 -4
Output example #1
9 5 -7 -7 -9 -4
Input example #2
10 -8 -10 -2 1 -9 5 -9 0 0 -9
Output example #2
-8 -10 -10 -2