Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- char str[150];
- char word[150];
- gets(str);
- gets(word);
- char *pw=strtok(word," ");
- int l=strlen(str);
- int d=strlen(word);
- printf("%d\n",l);
- for(int i=0;i<l;i++){
- if(str[i]=='$'){
- int d=strlen(pw);
- for(int j=0;j<l-i;j++){
- str[l+d-j-1]=str[l-j];
- }
- for(int j=0;j<d;j++){
- str[i+j]=pw[j];
- }
- pw=strtok(NULL," ");
- l=strlen(str);
- }
- }
- printf("%s",str);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment