You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
640 B

#include <bits/stdc++.h>
using namespace std;
string p, s;
void to_lower(string &s) {
for (auto &c : s) c = tolower(c);
}
int main() {
getline(cin, p);
getline(cin, s);
to_lower(p), to_lower(s);
int cnt = 0, k = -1;
for (int i = 0; i < s.size(); i++) {
if (s[i] == ' ') continue;
int j = i + 1;
while (j < s.size() && s[j] != ' ') j++;
if (p == s.substr(i, j - i)) {
cnt++;
if (k == -1) k = i;
}
i = j;
}
if (!cnt)
puts("-1");
else
cout << cnt << ' ' << k << endl;
return 0;
}