#include<iostream>
#include<string>
#include<cctype>
using namespace std;
void toLower(string& str) {
for(char& c:str) {
c = tolower(c);
}
}
int main() {
string sub;
cin>>sub;
toLower(sub);
string str;
cin.ignore();
getline(cin, str);
toLower(str);
size_t pos = 0;
int cnt = 0;
int first = -1;
while((pos = str.find(sub, pos)) != string::npos) {
int len = sub.size();
if(pos == 0) {
if(str[pos+len]==' ') {
cnt++;
if(first==-1) first = pos;
}
} else {
if(str[pos-1]==' '&&str[pos+len]==' ') {
cnt++;
if(first==-1) first = pos;
}
}
pos += len;
}
if(cnt!=0) {
cout<<cnt<<" "<<first<<endl;
} else {
cout<<-1<<endl;
}
return 0;
}
网硕互联帮助中心




评论前必须登录!
注册