文章

20

粉丝

0

获赞

53

访问

2.0k

头像
字符串匹配 - 兰州大学 题解:
P1717 兰州大学机试题
发布于2026年3月22日 20:03
阅读数 67

#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    string s1,s2;
    cin>>s1>>s2;
    if(s2.find(s1)!=string::npos){
        int x=s2.find(s1);
        s2.erase(x,s1.size());
        cout<<s2<<endl;
    }else{
        cout<<"-1"<<endl;
    }

    return 0;
}
 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发