4 solutions

  • 1
    @ 2025-3-17 17:56:01
    #include<bits/stdc++.h>
    using namespace std;
    const int N=1e2+1e2+10;
    char str[N];
    int main()
    {
        cin.getline(str,N);
        int a=strlen(str);
        char x,y;
        cin>>x>>y;
        for(int i=0;i<=a;i++)
        {
            if(str[i]==x)
            {
                str[i]=y;
            }
        }
        cout<<str;
        return 0;
    }
    

    Information

    ID
    83
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    # Submissions
    98
    Accepted
    42
    Uploaded By