1 条题解

  • 0
    @ 2023-9-11 17:16:59
    #include<bits/stdc++.h>
    using namespace std;
    void findStr(string str);
    void replace (string str);
    int main()
     {
        char str[50][100];
        int n;
        scanf("%d", &n);
        for (int i = 0; i < n; i++) {
            scanf("%s", &str[i]);
        }
        for (int i = 0; i < n; i++) {
            replace(str[i]);
        }
        return 0;
    
    }
    void findStr(string str) {
    
        cout << str.find("Ban_smoking") << endl;
    
    }
    
     
    
    void replace (string str) {
    
        int pos;
    
        pos = str.find("Ban_smoking");
    
        while (pos != -1) {
    
            str.replace(pos, string("Ban_smoking").length(), "No_smoking");
    
            pos = str.find("Ban_smoking");
    
        }
    
        cout << str << endl;
    
    }
    
    • 1

    信息

    ID
    76
    时间
    1000ms
    内存
    256MiB
    难度
    4
    标签
    递交数
    107
    已通过
    51
    上传者