#include<iostream>
#include<string>
using namespace std;
int main()
{
string a,b;
int flag;
while (cin >> a >> b)
{
for (int i = 0; i <= a.size() - 1; i++)
{
flag = 0;
if (a[i] == b[0])
{
for (int j = 1; j <= b.size() - 1; j++)
{
if(b[j] == a[i + j])
{
continue;
}
else
{
flag = 1;
break;
}
}
if (flag)
continue;
else cout << i + 1 << endl;
}
}
}
return 0;
}
1204 寻找子串位置
最新推荐文章于 2020-12-20 11:01:05 发布