删除一个字符串中的指定字母

#include <stdio.h>
#include<string.h>
int main()
{
	char arr1[256] = { 0 };
	char arr2[256] = { 0 };
	int len1, len2;
	char a,i,j;
	scanf("%s", &arr1);//输入一串字符
	len1 = strlen(arr1);
	scanf("%s", &arr2);//输入要删除的字符
	len2 = strlen(arr1);
	for (i = 0; i < len1; i++)
	{
		for (j = 0; j < len2; j++)
		{
			if (arr1[i] == arr2[j])
			{
				break;
			}
			else if (j = len2 - 1)
			{
				printf("%c", arr1[i]);
			}
		}
	}
	printf("\n");
	return 0;
}

题目来源于:
https://www.nowcoder.com/tutorial/10002/b8a99ae4620b4a47b3d84a63a264ed0a

上一篇:leetcode刷题第一天


下一篇:delphi计算两个时间差-转