Skip to content

Instantly share code, notes, and snippets.

@ingyeoking13
Created January 15, 2018 11:43
Show Gist options
  • Save ingyeoking13/33d6ae55824fff07ff238c33096f314e to your computer and use it in GitHub Desktop.
Save ingyeoking13/33d6ae55824fff07ff238c33096f314e to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
int main(){
char tmp[101];
scanf("%101[^\n]", tmp); //엔터(return)키 들어오기 전까지 계속 입력받기
int len = strlen(tmp);
int chk = 0;
for (int i=0; i<len; i++) { //입력받은 문자열의 길이 까지~
if (tmp[i]=='@' && (!chk)) //지금 문자의 인덱스가 @이고 한번도 안바꿨을 경우
tmp[i]='&', chk=1;
else if (tmp[i]!='@') //지금 문자가 @가 아닌경우
chk=0;
}
printf("%s\n", tmp);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment