U E D R , A S I H C RSS

Ancient Cipher/정진경

Source Code

#include <stdio.h>
#include <string.h>
int main ()
{
	char s1[110];
	char s2[110];
	int l1,l2;
	int c1[26],c2[26];
	int i,j;
        memset (c1,0,sizeof(c1));
	memset (c2,0,sizeof(c2));
	scanf ("%s",s1);
	scanf ("%s",s2);
	l1=strlen (s1);  l2=strlen (s2);
	if (l1!=l2)  { printf ("NO\n"); return 0; }
	
	for (i=0;i<l1;i++)  c1[s1[i]-'A']++;
	for (i=0;i<l2;i++)  c2[s2[i]-'A']++;

	for (i=0;i<26;i++)
	{
		for (j=0;j<26;j++)
			if (c1[i]==c2[j])  break;
		if (j>=26)  break;
		c2[j]=0;
	}
	if (i<26)  printf ("NO\n");
	else printf ("YES\n");
	

	return 0;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2011-08-30 09:35:55
Processing time 0.0121 sec