Advertisement
j33vansh

Answer 5 Strings CPP

Jul 1st, 2021
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include<iostream>
  2. #include<string>
  3. using namespace std;
  4. int main()
  5. {
  6.     ios_base::sync_with_stdio(false);
  7.     cin.tie(NULL);
  8.     string str;
  9.     int t;
  10.     cin>>t;
  11.     while(t>0)
  12.     {
  13.         cin>>str;
  14.         int k=str.size();
  15.         int i=0;
  16.         while(i<=k)
  17.             {
  18.                 if(str.substr(i,5)=="party")
  19.                 {
  20.                     str.replace(i,5,"pawri");
  21.                 }
  22.                 i++;
  23.             }
  24.     cout<<str<<endl;
  25.     t--;
  26.     }
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement