Create 1756.c

pull/21/head^2
Kirigaya Kazuto 2016-06-11 19:25:35 +08:00 committed by GitHub
parent eafa27063a
commit 91e473ce32
1 changed files with 22 additions and 0 deletions

22
QUSTOJ/1756.c Normal file
View File

@ -0,0 +1,22 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void replace(char* str,char a,char b)
{
int L=strlen(str);
for(int i=0;i<L;i++)
{
if(str[i]==a) str[i]=b;
}
}
char msg[1024];
int main()
{
gets(msg);
char a,b;
scanf("%c,%c",&a,&b);
replace(msg,a,b);
printf("%s\n",msg);
return 0;
}