squeeze (s1, s2), the string s1 match any character string s2 deleted

void squeeze(char a[],char  b[])
{
        //要实现把s2的任意字符如果出现的话就在s1中删除
        //1.首先判断s1[j]==s2[i]&&s1[j]=='\0'
    int j,i;
    for( j=0;b[j]!='\0';j++)//遍历一遍b[]
    {
            for(i=0;a[i]!='\0';i++)//遍历一遍a
            {
                    if(a[i]==b[j])
                    for(int m=i;(a[m]=a[1+m])!='\0';m++);//消除元素

            }
    }


}
//其实里面那些{}可以删掉 不过删了的话就不美观了

Guess you like

Origin www.cnblogs.com/my-study/p/12236497.html