最后1个AC,其它都是RE,大佬能帮我看下哪出错了嘛
查看原帖
最后1个AC,其它都是RE,大佬能帮我看下哪出错了嘛
755222
Lawate楼主2022/10/20 14:12
#include<iostream>
using namespace std;
#include<string>
int main()
{
    int q;
    cin >> q;
    string s;
    cin >> s;
    int t;
    string x;
    for (int i = 0; i < q; i++)
    {
        cin >> t >> x;
        if (t == 1)
        {
            s = s + x;
            cout << s << endl;
        }
        else if (t == 2)
        {
            s.substr(x[0], x[1]);
            cout << s << endl;
        }
        else if (t == 3)
        {
            int a = 0;
            a = x[0];
            x.erase(0);
            s.insert(a, x);
            cout << s << endl;
        }
        else if (t == 4)
        {
            if (s.find(x) < s.size())
                cout << s.find(x) << endl;
            else
                cout << -1 << endl;
        }
    }
    return 0;
}

感谢!!!

2022/10/20 14:12
加载中...