WA for ANAGRAM TECH04

,

Problem link : TECH04

My code : TECH04

You forgot your curly brackets around your else.

	else	
		sort (a, a + strlen(a));
		sort (b, b + strlen(b));
		for (y = 0, z = 0; y < strlen(a); ++y, ++z)
		{
			if (a[y] == b[z])
			m = m + 1;
		}
		if (m == strlen(a))
			printf ("YES\n");
		else
			printf ("NO\n");

should be

	else
	{
		sort (a, a + strlen(a));
		sort (b, b + strlen(b));
		for (y = 0, z = 0; y < strlen(a); ++y, ++z)
		{
			if (a[y] == b[z])
			m = m + 1;
		}
		if (m == strlen(a))
			printf ("YES\n");
		else
			printf ("NO\n");
	}
1 Like
//