1039 in the end buying, C

#include <stdio.h>

int main()
{
	char a[1001]={0},b[1001]={0};
	int i=0,j,flag,c=0;			//c是没有的珠子数
	scanf("%s %s",a,b);
	while(b[i])
	{
		j=0;	flag=0;
		while(a[j])
		{
			if(b[i] == a[j])
			{
				flag = 1;
				a[j] = '+';  //随便什么符号都行,只要不属于[0-9]、[a-z]、[A-Z]范围内
				break;
			}
			j++;
		}
		if(!flag)	c++;
		i++;
	}

	if(c)
		printf("No %d",c);
	else
	{
		c = strlen(a) - strlen(b);
		printf("Yes %d",c);
	}

	return 0;
}
Published 44 original articles · won praise 0 · Views 869

Guess you like

Origin blog.csdn.net/weixin_43916400/article/details/104522708