Kindly tell what's wrong

https://www.codechef.com/problems/PAWRI

i have been stuck for a while now
coding blocks ide is not working !!

#include
#include
using namespace std;

int main() {
int t;
cin >> t;
while (t–)

{
    string s;
    cin >> s;
    while (s.find("party") < s.length())
    {
        int k = s.find("party");
        s.replace(k, 5, "pawri");
    }

    cout << s << endl;


}

}

hello @laksh.rustagi12

what issue u r facing ?

also pls share ur code using any other ide

bhaiya many people have submitted the prob with the same approach as mine but i’m getting tle.

s.find will retunr -1 if no elements found so change ur while condition

s.find()!=-1

no it returns some out of bound number acc to me

ss

unsigned value of -1 is the largest number.
then i dont see any reason for tle

I am also not getting it

find function takes linear time , so that is making ur program little slow

pass last seen index of party +1 in second argument of find and then try

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.