Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <iostream>
  2. #include<cstring>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. char s[101],cuv[11],p[101];
  8. cin.getline(s,101);
  9. cin>>cuv;
  10. int i=0,j=0,k,m=0,ok;
  11. while(j<strlen(s))
  12. {
  13. ok=1;
  14. k=0;
  15. while(s[j]!=' '&&s[j]!='\0')
  16. {
  17. if(cuv[k]!=s[j])
  18. ok=0;
  19. p[m]=s[j];
  20. k++;
  21. j++;
  22. m++;
  23. }
  24. if(ok==1)
  25. {
  26. p[m]='#';
  27. m++;
  28. p[m]=' ';
  29. m++;
  30. }
  31. else
  32. {
  33. p[m]=' ';
  34. m++;
  35. }
  36.  
  37. i=j=j+1;
  38. }
  39. m++;
  40. p[m]='\0';
  41. cout<<p;
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement