Slavik9510

Untitled

Dec 6th, 2021
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. int main()
  4. {
  5. char str[150];
  6. char word[150];
  7. gets(str);
  8. gets(word);
  9. char *pw=strtok(word," ");
  10. int l=strlen(str);
  11. int d=strlen(word);
  12. printf("%d\n",l);
  13. for(int i=0;i<l;i++){
  14.     if(str[i]=='$'){
  15.         int d=strlen(pw);
  16.         for(int j=0;j<l-i;j++){
  17.             str[l+d-j-1]=str[l-j];
  18.         }
  19.         for(int j=0;j<d;j++){
  20.             str[i+j]=pw[j];
  21.         }
  22.         pw=strtok(NULL," ");
  23.         l=strlen(str);
  24.     }
  25. }
  26. printf("%s",str);
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment