Run ID:57160

提交时间:2023-08-26 20:15:42

#include<iostream> #include<cstring> using namespace std; int main(){ string s1,s2; int a,s=0,l,w; getline(cin,s1); getline(cin,s2); for (int i=0;i<s1.length();i++){ if (s1[i]>='A'&&s1[i]<='Z') s1[i]=s1[i]+32; } for (int i=0;i<s2.length();i++){ if (s2[i]>='A'&&s2[i]<='Z') s2[i]=s2[i]+32; } s1=' '+s1+' '; s2=' '+s2+' '; w=s2.find(s1); if (w==-1){ cout<<-1<<endl; return 0; } else{ l=s1.length(); a=w; while(a!=-1){ s++; s2.erase(a,l); a=s2.find(s1); } cout<<s<<" "<<w<<endl; return 0; } }