0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-30 23:16:30 +00:00
OI-codes/Luogu/P1308/P1308.cpp

23 lines
509 B
C++

#include <bits/stdc++.h>
using namespace std;
int cnt, now;
string w, s;
int main() {
getline(cin, w);
getline(cin, s);
w = ' ' + w + ' ';
s = ' ' + s + ' ';
transform(w.begin(), w.end(), w.begin(), ::tolower);
transform(s.begin(), s.end(), s.begin(), ::tolower);
if (s.find(w) == string::npos) {
cout << -1 << endl;
} else {
while ((now = s.find(w, now)) != string::npos) cnt++, now++;
cout << cnt << ' ' << s.find(w) << endl;
}
return 0;
}