http://ac.jobdu.com/problem.php?pid=1006
#include <stdio.h> char str[1005]; int main() { int a,b,c,z,j,i; //a:z前面o的个数,b:zj间o的个数,c:j后面o的个数 while (scanf("%s",str)!=EOF) { a=0,b=0,z=0,j=0,c=0; for(i=0;str[i]!='\0';i++) { if (str[i]=='o'&&z==0) { a++; } else if (str[i]=='z') { z++; } else if (str[i]=='o'&&j==0) { b++; } else if (str[i]=='j') { j++; } else if (str[i]='o') { c++; } } if ( z==1&&j==1&&( ( b==1&&(a==c) )||(b>1&&a*b==c ) ) ) { printf("Accepted\n"); } else printf("Wrong Answer\n"); } return 0; }