| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
神呀,救救我吧,不觉得有问题了怎么还是WA呢?#include<stdio.h>
void change(char a[],char c)
{
a[0]=a[1];
a[1]=a[2];
a[2]=a[3];
a[3]=c;
}
int main()
{
char out[100];
char c;
int i=0;
char a[4]={'EOF','EOF','EOF','EOF'};
while((c=getchar()))
{
change(a,c);
if(c=='F')
{
if(a[3]=='F'&&a[2]=='O'&&a[1]=='E')
{
i=i-2;
break;
}
}
int j=3;
if(c>='a'&&c<='z'||c==' '||c=='\n'||c=='\t')
{
if(c=='\n')
{
out[i++]=c;
for(int j=0;j<i;j++)
printf("%c",out[j]);
i=0;
continue;
}
if(c=='i'&&i>1&&a[j-1]=='e')
{
if(a[j-2]=='c')
out[i++]=c;
else
{
out[i-1]='i';
out[i++]='e';
}
}
else if(c=='d'&&i>0)
{
if(a[j-1]=='d')
out[i-1]='p';
else
out[i++]='d';
}
else if(c=='k'&&i>2&&a[j-1]=='n'&&a[j-2]=='i'&&a[j-3]=='p')
{
out[i+1]='d';
out[i]='y';
out[i-1]='o';
out[i-2]='l';
out[i-3]='f';
i=i+2;
}
else
out[i++]=c;
}
else
continue;
}
for(int j=0;j<i;j++)
printf("%c",out[j]);
//printf("\n");
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator