What is wrong in this code

#include
#include
using namespace std;
int main()
{
stack s;
int n,data;
cin>>n;
int curr=1;
for(int i=0;i<n;i++)
{
cin>>data;
if(s.empty())
{
s.push(data);
cout<<β€œ1”<<" β€œ;
}
else
{
if(data>s.top())
{
s.push(data);
curr++;
cout<<curr<<” β€œ;
}
else
{
s.push(data);
curr=1;
cout<<curr<<” ";
}
}
}
cout<<β€œEND”;
}

@Adityakumar3112
Please send your code on CB IDE

@Adityakumar3112
Your code failed this Test Case
Q : 5
30
40
35
45
42
A : 1 2 1 4 1 END

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.