getting correct ans on my pc compiler of question link text bt showing wrong ans on codechef . please help ..code is in c language
include<stdio.h>
int main() {
int n,i,j,top=-1;
char a[400],stack[400];
char temp;
scanf("%d",&n);
for(j=0;j<n;j++)
{
scanf("%s",&a);
for(i=0;i<strlen(a);i++)
{
while(a[i]=='(')
{
i++;
}
if(a[i]=='+' || a[i]=='-' || a[i]=='/' || a[i]=='*' || a[i]=='^')
{
temp=a[i];
top++;
stack[top]=temp;
}
else
if(a[i]==')')
{
printf("%c",stack[top]);
--top;
}
else
printf("%c",a[i]);
if(i==(strlen(a)-1) && top>-1)
{
printf("%c",stack[top]);
}
}}
return 0;
}