| ||||||||||
| 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 | |||||||||
HELP,牛人们.WA啊!!#include<stdio.h>
void main()
{
char str[30];
int i,j,k;
while(scanf("%s",str)!=EOF)
{
for(i=0;str[i];i++)
{
if(str[i]=='B'||str[i]=='F'||str[i]=='P'||str[i]=='V')
{
printf("1");
j=i;
while(1)
{
if(str[j]!='B'&&str[j]!='F'&&str[j]!='P'&&str[j]!='V')
break;
else
j++;
}
i=j;
}
if(str[i]=='C'||str[i]=='G'||str[i]=='J'||str[i]=='K'||str[i]=='Q'||str[i]=='S'||str[i]=='X'||str[i]=='Z')
{
printf("2");
j=i;
while(1)
{
if(str[j]!='C'&&str[j]!='G'&&str[j]!='J'&&str[j]!='K'&&str[j]!='Q'||str[j]!='S'||str[j]!='X'||str[j]!='Z')
break;
else
j++;
}
i=j;
}
if(str[i]=='D'||str[i]=='T')
{
printf("3");
j=i;
while(1)
{
if(str[j]!='D'&&str[j]!='T')
break;
else
j++;
}
i=j;
}
if(str[i]=='L')
{
printf("4");
j=i;
while(1)
{
if(str[j]!='L')
break;
else
j++;
}
i=j;
}
if(str[i]=='M'||str[i]=='N')
{
printf("5");
j=i;
while(1)
{
if(str[j]!='M'&&str[j]!='N')
break;
else
j++;
}
i=j;
}
if(str[i]=='R')
{
printf("6");
j=i;
while(1)
{
if(str[j]!='R')
break;
else
j++;
}
i=j;
}
}
printf("\n");
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator