#include<stdio.h>#include<string.h>#define SIZE 41int main () { char str[SIZE]; char order[5]; //命令格式最长需要的空间最大5 int i; char judge; //命令的方式符 char a,b; //D只需要a,其他需要a,b int len; gets(str); gets(order); judge = order[0]; if(judge == 'D'){ a = order[2]; } else { a = order[2]; b = order[4]; } len = strlen(str); if(judge == 'D'){ //D int temp = 0; for(i = 0; i < len; i ++){ if(temp == 0 && str[i] == a){ temp = 1; } else { PRintf("%c",str[i]); } } } else if(judge == 'I'){ //I int num = -1; for(i = 0; i < len; i ++){ if(str[i] == a){ num = i; } } for(i = 0; i < len; i ++){ if(i == num){ printf("%c",b); } printf("%c",str[i]); } } else { //R for(i = 0; i < len; i ++){ if(str[i] == a) printf("%c", b); else printf("%c",str[i]); } } return 0;}
新闻热点
疑难解答