Why I am getting a wrong answer?

My code is producing exactly the same output as the sample for Transform the expression question but even then it is getting a wrong answer.Please help to find what is wrong in this code-

 #include <stdio.h>
    #include <string.h>
    int pop( );
    void push(int c, int t);
    char a[100][400];
    char ac[400];
    char as[400];
    int ic = 0;
    int is = 0;
    int main()
    {
    	int z;
    	scanf("%d", &z);
    	
    	int i = 0;
    	int q = z;
    	while (q-- > 0)
    	{
    		
    		scanf("%s",&a[i]);
    		int t;
    		for (t = 0; t < strlen(a[i]); t++)    //loop to put the values and signs in the 2 stacks
    		{
    			if ((a[i][t] == '*') || (a[i][t] == '+') || (a[i][t] == '-') || (a[i][t] == '^'))
    			{
    				push(a[i][t], 2);
    				
    				
    			}
    				
    			else if (a[i][t] == ')')
    			{
    				int y = pop();
    				push(y, 1);
    				
    			}
    				
    			else if (a[i][t] != '(')
    			{
    				push(a[i][t], 1);
    				
    			}
    		}
    		memset(a[i], '\0', sizeof(a[i]));
    		strcpy(a[i++], ac);
    		memset(ac, '\0', sizeof(ac));
    		memset(as, '\0', sizeof(as));
    		ic = 0;
    		is = 0;
    		
    	}
    	int p;
    	for (p = 0; p <z ; p++)   
    		printf("%s\n",a[p]);
    	return 0;
    }
    
    
    void push(int c,int t)
    {
    	if (t == 1 && ic != 400)
    		ac[ic++] = c;
    	else if (t == 2 && is != 400)
    		as[is++] = c;
    }
    int pop()
    {
    	if (is>0)
    		return as[--is];
    	return EOF;
    }