i have written c program for Transform the Expression. checked it for many test cases. it worked fine. when i submit i showed wrong answer. i have cross checked the same testcases with other accepted submission. the output of my code and the accepted one was same. my c code is
#include<stdio.h>
#include<string.h>
char stk[1000];
int j;
int main()
{
int num,i,len,k;
char ch[1000];
scanf("%d",&num);
while(num)
{
printf("enter the elements\n");
scanf("%s",ch);
num--;
//printf("%s\n",ch);
len=strlen(ch);
//printf("%d",len);
j=0;
k=0;
while(k<=len)
{
if((ch[k]>='a' && ch[k]<='z'))
{
printf("%c",ch[k]);
k++;
}
else if(ch[k]==')')
{
k++;
j--;
while(stk[j]!='(')
{
printf("%c",stk[j]);
j--;
}
}
else
{
//printf("hellloooo\n");
stk[j]=ch[k];
j++;
k++;
}
}
}
return 0;
}
please help in moving forward. waiting for reply