1 solutions

  • 0
    @ 2025-12-15 11:58:22

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    string s,a="apple";
    int main()
    {
    	while(getline(cin,s))
    	{
    		int t=s.find(a);
    		for(;t>=0;)
    		{
    			s.replace(t,5,"peach");
    			t=s.find(a);
    		}
    		cout<<s<<endl;	
    	}
    	return 0;
    	 
    }
    
    • 1

    Information

    ID
    1058
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By