Where is the following code going wrong. Plz help

i have written this following code for a problem with link https://www.codechef.com/problems/COOMILK
and i have written the code in c++ 14 which is as follows.
https://www.codechef.com/viewsolution/37383897
I am getting correct output on my machine(i tested the sample inputs) but the codechef compiler gives error as : wrong answer.
Please point out my mistake with the code solution.

If I’m understanding the question correctly; consider the test input:

1
1
milk
3 Likes

You are missing an edge case. Read the statement carefully once again.

Spoiler
1
2
milk cookie
3 Likes

bro u missed the edge cases…
if(n==1&&s[0]==“cookie”) order=0;
else if(s[n-1]==“cookie”) order=0;

which is only cookie in the 1 minute(i.e N=1) or cookie at last minute