https://www.codechef.com/LRNDSA02/problems/COMPILER

//my code shows wrong answer after submission, i’m unable to find the test case for that it is wrong
here is submission
#include <bits/stdc++.h>
using namespace std;

int main() {
// your code goes here
ios_base::sync_with_stdio(false);
cin.tie(NULL);
stack r;
int t;
cin>>t;
for(int i=0;i<t;i++)
{
string s;
int l=0,m=0;
cin>>s;
if(s[0]!=‘>’)
{
while(m<s.size())
{
if(s[m]==‘<’)
r.push(s[m]);
if(s[m]==‘>’)
{
if(!r.empty())
{
r.pop();
l++;
}
}
m++;
}

    }
   if(l=='0')
   cout<<"0"<<endl;
   else
   cout<<l*2<<endl;
   while(!r.empty())
   {
       r.pop();
   }
   while(!s.empty())
   {
       s.pop_back();
   }
}
return 0;

}

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

He doesn’t even care to mention the issue. :neutral_face:

First sir, Thank you very much for your response .
Actually sir its my first time in discussion therefore I directly post my code.

Thanks :slight_smile:

I am Sorry for being rude.

1 Like

it runs . it shows 2

why its answer should be zero

ok i got it , we have to print prefix

now , i’ve clear all test case !!! :smiley:

1 Like