Single testcase not passing

Single testcase not passing.

the testcase which is not passed is

5
30 40 35 45 42
for this input
Your Output
1 2 1 2 1 END
Expected Output
1 2 1 4 1 END

now you will be thinking why 4??

read the question specifically the definition of span

A span of a stock’s price on a given day, i, is the maximum number of consecutive days before the (i+1)th day, for which stock’s price on these days is less than or equal to that on the ith day.

to calculate span price on 4th day (3rd index i.e 45)
all stock price previous of this are smaller than 45 so span of 4th day is 4

After 2-3 more attempts and thinking on your hint, I was able to solve this, thank you.