#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[])
{
char str[1000];
int front, middle, behind, N;
int count_z = 0, count_j = 0;//记录zj的个数
int index_z = -1, index_j = -1;//记录zj的位置
int i;
while(EOF != scanf("%s",str))
{
//查找ZJ的位置,并记录其前中后有多少个o字符
index_j = -1;
index_z = -1;
count_j = 0;
count_z = 0;
for(i = 0; i < strlen(str); ++i)
{
if (str[i] == 'z')
{
index_z = i;
count_z++;
}
if (str[i] == 'j')
{
index_j = i;
count_j++;
}
}
//如果count>1或者index中有一个为-1,则WA
if (count_j > 1 | count_z > 1 | index_z == -1 | index_j == -1 | index_j < index_z)
{
printf("Wrong Answer\n");
continue;
}
else
{//计算前中后的‘o’的个数
front = index_z;
middle = index_j - index_z - 1;
behind = strlen(str) - index_j - 1;
if (middle >= 1 && front*middle == behind)
{
printf("Accepted\n");
continue;
}
else
{
printf("Wrong Answer\n");
continue;
}
}
}
return 0;
}
/**************************************************************
Problem: 1006
User: tenyee
Language: C
Result: Accepted
Time:30 ms
Memory:912 kb
****************************************************************/
时间有点长了,后面想想哪占了这么多时间吧