题目链接:War of the Corporations
题目大意
给你一个串 s 和 串 t , 问串 s 至少经过几次变换才不包含子串 t,求最小操作数。
#include <bits/stdc++.h>
using namespace std;
string s,t;
int main()
{
cin>>s>>t;
int res=0;
if(s.size()>=t.size())
{
for(int i=0;i<s.size()-t.size()+1;++i)
if(s.substr(i,t.size())==t) s[i+t.size()-1]='#',res++;
}
printf("%d\n",res);
return 0;
}