赞
踩
- class Solution {
- public:
- char* delChar(char* s1,char* s2)
- {
- if(s1==nullptr)
- return nullptr;
- if(s2==nullptr)
- retrun s1;
-
- const int tableSize=256;
- int table[tableSize];
- for(int i=0;i<tableSize;++i)
- table[i]=0;
-
- char* p=s2;
- while(*p != '\0')
- {
- table[*p]++;
- p++;
- }
-
- char* res=s1;
- char* ret=res;
- p=s1;
- while(*p != '\0')
- {
- if(table[*p]==0)
- *res++ = *p;
- p++;
- }
- *res='\0';
-
- return ret;
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。