This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#include <bits/stdc++.h>
using namespace std;
int pos;
int cnt;
string a, B;
int main() {
cin >> a;
for (int i = 0; i < a.size(); i++)
if (a[i] >= 'A' && a[i] <= 'Z') a[i] += 32;
a = ' ' + a + ' ';
//读入一行数据之前,如果有输入,要getchar();
getchar();
getline(cin, b);
b = ' ' + b + ' ';
for (int i = 0; i < b.size(); i++)
if (b[i] >= 'A' && b[i] <= 'Z') b[i] += 32;
//在b中查找a
int p = 0;
while ((p = b.find(a, p)) != b.npos) {
cnt++;
if (cnt == 1) pos = p;
p++;
}
if (cnt > 0) printf("%d %d\n", cnt, pos);
else printf("%d", -1);
return 0;