#Salve in Python
def DeleteNodes(ls):
n=len(ls)
for i in range(n):
if i+1<len(ls) and ls[i]<ls[i+1]:
ls.pop(i)
n-=1
i-=1
if len(ls)>2:
if ls[len(ls)-2]<ls[len(ls)-1]:
ls.pop(len(ls)-2)
return ls
ls=list(map(int,input().split(' ')))
ls=DeleteNodes(ls)
print(ls)
Comments
Leave a comment