这个在DEVCpp上可以正常运行,但是提交的时候就CE 了
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
char word[20],passage[1000020];
int Word[20],Passage[1000020];
int length;
int time;
int place=-1;
void NoCapitalLetter(char a[]){
for(int i=0; ; i++){
if((int)a[i]>=65 && (int)a[i]<=90){
a[i]=a[i]+32;
(char)a[i];
}
if(a[i]==' ' && a[i+1]==' '){
break;
}
}
}
void LetterToNumber(char a[],int b[]){
for(int i=0; ; i++){
b[i]=a[i];
if(a[i]==' ' && a[i+1]==' '){
break;
}
}
}
int main(){
for(int i=0; i<=15; i++) word[i]=' ';
for(int i=0; i<=1000010; i++) passage[i]=' ';
gets(word);
gets(passage);
NoCapitalLetter(word);
NoCapitalLetter(passage);
LetterToNumber(word,Word);
LetterToNumber(passage,Passage);
for(int i=0; i<=15; i++) if(Word[i]<97 || Word[i]>122) Word[i]=32;
for(int i=0; i<=1000010; i++) if(Passage[i]<97 || Word[i]>122) Passage[i]=32;
for(int i=0; i<=12; i++){
if(Word[i]==32){
length=i;
break;
}
}
if(Passage[0]==Word[0]){
for(int j=1; j<=length-1; j++){
if(Passage[j]!=Word[j]) break;
if(j==length-1){
if(Passage[j]==Word[j]){
time++;
if(place==-1){
place=0;
}
}
}
}
}
for(int i=0; i<=1000005; i++){
if(Passage[i]==32 && Passage[i+1]==32){
break;
}
if(Passage[i]==32 && Passage[i+length+1]==32){
for(int j=1; j<=length; j++){
if(Passage[i+j]!=Word[j-1]) break;
if(j==length){
if(Passage[i+j]==Word[j-1]){
time++;
if(place==-1){
place=i+1;
}
}
}
}
}
}
if(time!=0) cout<<time<<' ';
cout<<place<<endl;
return 0;
}