fork download
  1. #include <stdio.h>
  2.  
  3. #define N 4
  4. int main() {
  5. char fields[N];
  6. int w = 0;
  7. while (1) {
  8. char *p;
  9. if (fgets(fields, N, stdin) == 0)
  10. break;
  11. for (p = fields; *p; p++) {
  12. if (*p == 'W')
  13. w++;
  14. }
  15. }
  16. if (w >= 5)
  17. printf("OK\n");
  18. else
  19. printf("NG\n");
  20. return 0;
  21. }
  22. /* end */
  23.  
Success #stdin #stdout 0s 2172KB
stdin
S S W W S W S S S S
stdout
NG