题目1160: 字符串去特定字符
输入字符串s和字符c,要求去掉s中所有的c字符,并输出结果。
输入
测试数据有多组,每组输入字符串s和字符c。
输出
对于每组输入,输出去除c字符后的结果。
样例输入
goaod
a
样例输出
good
提示 [+]
*** 提示已隐藏,点击上方 [+] 可显示 ***
来源
2009年哈尔滨工业大学计算机研究生机试真题
/********************************* * 日期:2013-3-5* 作者:SJF0115 * 题号: 天勤OJ 题目1160: 字符串去特定字符* 来源:http://acmclub.com/problem.php?id=1160* 结果:AC * 来源:2009年哈尔滨工业大学计算机研究生机试真题* 总结: **********************************/ #include<stdio.h> #include<stdlib.h>#include<string.h>int main(){int i,len;char c;char array[1000];while(gets(array)){scanf("%c",&c);len = strlen(array);for(i = 0;i < len;i++){if(array[i] == c){continue;}else{printf("%c",array[i]);}}printf("\n");getchar();}return 0;}