39 lines
716 B
C++
39 lines
716 B
C++
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <ctype.h>
|
|
|
|
int main(){
|
|
char a[100001];
|
|
char test[11];
|
|
scanf("%s",test);
|
|
getchar();
|
|
scanf("%[^\n]",a);
|
|
int js=0;
|
|
//printf("strlen's test:%d\n",strlen(a));
|
|
for(int i=0;i<strlen(test);i++){
|
|
test[i]=tolower(test[i]);
|
|
}
|
|
for(int i=0;i<strlen(a);i++){
|
|
a[i]=tolower(a[i]);
|
|
}
|
|
int start=0;
|
|
bool flag=false;
|
|
for(int i=0;i<=strlen(a);i++){
|
|
int j=i;
|
|
//printf("before:%d ",j);
|
|
while(a[j]==test[j-i]&&(j-i)<=strlen(test)){
|
|
j++;
|
|
}
|
|
//printf(" after:%d\n",j);
|
|
if((j-i)==strlen(test)||(j-i)==strlen(test)+1)
|
|
js++;
|
|
if(js==1&&flag==false){
|
|
start=i;
|
|
flag=true;
|
|
}
|
|
}
|
|
if(js!=0) printf("%d %d",js,start);
|
|
else printf("-1");
|
|
return 0;
|
|
}
|