题目1049:字符串去特定字符 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:8177 解决:3692 题目描述: 输入字符串s和字符c,要求去掉s中所有的c字符,并输出结果。 输入: 测试数据有多组,每组输入字符串s和字符c。 输出: 对于每组输入,输出去除c字符后的结果。 样例输入: heallo a 样例输出: hello 来源: 2009年哈尔滨工业大学计算机研究生机试真题 #include<stdio.h> #include<string.h> int main() { char str[1024]; char c; while(scanf("%s",str)!=EOF) { getchar(); scanf("%c",&c); int len=strlen(str); for(int i=0;i<len;i++) { if(str[i]!=c) { printf("%c",str[i]); } } printf("\n"); } return 0; }