Stock Span Problem

My code is failing for single test case, please help me out.

hello @56amrut.bhokardankar
image
u should pop from stack only when s.top() <= x

please elaborate, i am unable to clear the same test case

you will get a wrong answer for the test case:

Input:
5
1 11 6 16 13

Correct output:
1 2 1 4 1 END

Your Output:
1 2 1 2 1 END

Check with this case and try to correct.

Thanks for the help, can you please suggest some simpler way than mine

You can refer this https://ide.codingblocks.com/s/265717