I keep getting WA, but I think I have the right concept, can someone give me some input/output?
here is my code in C.pls some1 chk
/* @BEGIN_OF_SOURCE_CODE */
/* @JUDGE_ID: 25021WT 642 C */
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int sort (char * , char * );
void main()
{
char s[105][8],t[105][8] ,c[8],st[8];
int i,j, print,k,l,len;
// freopen("amalgama.in","r",stdin);
// freopen("amalgama.out","w",stdout);
for(k=0;;k++)
{
scanf("%s",&s[k]);
if(strcmp(s[k],"XXXXXX")==0)
break;
}
for(l=0;;l++)
{
scanf("%s",&t[l]);
if(strcmp(t[l],"XXXXXX")==0)
break;
}
for(j=0;j<l;j++)
{
print = 0;
strcpy(st,t[j]);
len = strlen(st);
qsort(st,len,sizeof(char),
(int (*)(const void *,const void *))sort);
for(i=0;i<k;i++)
if(len == strlen(s[i]))
{
strcpy(c,s[i]);
len = strlen(c)
qsort(c,len,sizeof(char),
(int (*)(const void *,const void *))sort);
if(strcmp(st,c)==0)
{
printf("%s\n",s[i]);
print++;
}
}
if(!print)
printf("NOT A VALID WORD\n");
printf("******\n");
}
fclose(stdin);
fclose(stdout);
}
int sort (char *a , char *b )
{
if(*a > *b)
return 1;
else if( *a < *b)
return -1;
return 0;
}
/* @END_OF_SOURCE_CODE */


