#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
string s1, s2;
vector<int> f, e;
cin >> s1 >> s2;
for (int i = 0; i < s1.size();i++) {
//for(auto iter2=s2.begin();iter2!=s2.end();iter2++)
if (s2[0] == s1[i])
f.push_back(i);
if (s2[s2.size() - 1] == s1[i])
e.push_back(i);
}
int temp, temp2=1000;
int res1=-1, res2=-1;
for(int i=0;i<e.size();i++)
for (int j = 0; j < f.size(); j++) {
if (f[j] >= e[i])
continue;
temp = e[i]-f[j];
if (temp+1 >= s2.size()&&temp<temp2) {
res1 = f[j];
res2 = e[i];
}
if(temp2>temp)
temp2 = temp;
}
cout << res1<< ' ' << res2;
return 0;
}
小米笔试题,当时没有加if(temp2>temp)这个判断,只通过80%