res表示一共遍历牛唱的字符串中字符的个数
#include<iostream>
#include<string>
using namespace std;
int main()
{
string str, str2;
cin >> str >> str2;
int a = str.size(), b = str2.size();
int res = 0;
for (int i = 0; i < b; i++)//遍历str2
{
for(;;res++)
{
if (str[res % a] == str2[i])
{
res++;
break;
}
}
}
cout << res / a + 1 << endl;
return 0;
}