mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-28 00:51:57 +00:00
23 lines
509 B
C++
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;
|
|
}
|