Program to find longest descending order subset from the list.
n = int(input())
li = list(map(int,input().split()))[:n]
max = 0
i = 0
startIndex = None
while i<n:
k = i
j = i+1
count = 1
while j<n:
if li[k]>li[j]:
count+=1
else:
break
k+=1
j+=1
if max<count:
max = count
startIndex = i
i = k
i+=1
print(*li[startIndex:startIndex+max])
li = list(map(int,input().split()))[:n]
max = 0
i = 0
startIndex = None
while i<n:
k = i
j = i+1
count = 1
while j<n:
if li[k]>li[j]:
count+=1
else:
break
k+=1
j+=1
if max<count:
max = count
startIndex = i
i = k
i+=1
print(*li[startIndex:startIndex+max])
Input
10
8 2 6 4 3 1 5 7 9 0
Output
6 4 3 1
10
8 2 6 4 3 1 5 7 9 0
Output
6 4 3 1