题目描述
输入字符串s和字符c,要求去掉s中所有的c字符,并输出结果。
输入描述:
测试数据有多组,每组输入字符串s和字符c。
输出描述:
对于每组输入,输出去除c字符后的结果。
示例1
输入
复制
heallo a
输出
复制
hello
#include<iostream>
#include<string>
char res[1000]={'\0'};
using namespace std;
int main(){
int i,count=0;
string str;
char c;
cin>>str>>c;
for(i=0;i<str.length();i++){
if(str[i]!=c) res[count++]=str[i];
}
cout<<res<<endl;
return 0;
}