Wrong answer in ONP-Transform the expression

My code inspite of generating all the test cases is showing wrong answer

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

typedef struct stack
{
  char a[400];
  int top;
}
stack;
stack s;
void push(char *,int);
int pop();

int main(void)
 {
  char x[400];
  int len,i,n,y;
  scanf("%d",&n);
  while(n>0)
  {
  scanf("%s",x);
  len=strlen(x);
  for(i=0;i<len;i++)
    {
      if((x[i])>=97&&x[i]<=122)
      printf("%c",x[i]);
      else
      if(x[i]=='/'||x[i]=='*'||x[i]=='+'||x[i]=='-'||x[i]=='^')
        {
        push(x,i);
        }
      else if(x[i]=='(')
      continue;
      else
       {
       y=pop();
       printf("%c",y);
       }
    }
    while (s.top !=0)
        {
          y = pop();
          printf("%c", y) ;
        }

    n--;
    }
    return 0;
   }
   void push(char *x,int i)
   {
     s.top++;
     s.a[s.top]=x[i];
   }
   int pop()
   {
     int temp;
     temp=s.a[s.top];
     s.top--;
     return temp;
   }

After each test case u need to move to a new line which ur code is not doing put a printf("\n") for each test case

You need to print each output ( expressions in RPN form ) at a new line and it will be accepted.

In your code, add a new line after exhausting the stack contents.


        while (s.top !=0)
        {
            y = pop();
            printf("%c", y) ;
        }
        printf("\n");  // new line after the stack elements are popped
        n--;
   

Check your accepted code with the above modification here.

Yes now its working Thanks.)