题目1049:字符串去特定字符
时间限制:1 秒
内存限制:32 兆
特殊判题:否
提交:10173
解决:4611
- 题目描述:
- 
输入字符串s和字符c,要求去掉s中所有的c字符,并输出结果。 
- 输入:
- 
测试数据有多组,每组输入字符串s和字符c。 
- 输出:
- 
对于每组输入,输出去除c字符后的结果。 
- 样例输入:
- 
heallo a
- 样例输出:
- 
hello1 #include <iostream> 2 #include <string> 3 using namespace std; 4 5 int main(){ 6 string s; 7 char c; 8 while(cin >> s >> c){ 9 for(int i = 0; i < s.length(); i++) 10 if(s[i] != c) 11 cout << s[i]; 12 cout << endl; 13 } 14 return 0; 15 }