Run ID:153253

提交时间:2026-05-10 16:07:48

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main() { string a,b; cin>>a; getchar(); getline(cin,b); int len1=a.size(); for (int i=0;i<len1;i++) { if(a[i]>='A'&&a[i]<='Z') { a[i]=a[i]+32; } } int count=0; int first=-1; int len2=b.size(); int i=0; while(i<len2) { while(i<len2&&b[i]==' ') { i++; } if (i>=len2) break; int st = i; string now; while (i<len2 && b[i]!=' ') { char c=b[i]; if (c>='A'&&c<='Z') { c=c+32; } now=now+c; i++; } if (now==a) { count++; if(first==-1) { first=st; } } } if (count==0) { cout<<-1<< endl; } else { cout<<count<<" "<<first<<endl; } return 0; }