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

23 lines
509 B
C++
Raw Normal View History

2020-09-20 08:17:26 +00:00
#include <bits/stdc++.h>
using namespace std;
int cnt, now;
string w, s;
2020-09-20 08:17:26 +00:00
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) {
2020-09-20 08:17:26 +00:00
cout << -1 << endl;
} else {
while ((now = s.find(w, now)) != string::npos) cnt++, now++;
cout << cnt << ' ' << s.find(w) << endl;
2020-09-20 08:17:26 +00:00
}
return 0;
}