#includeint main(void) { int state=0; char received; while(1) { received=getchar(); switch (state) { case 0: if (received=='f') state = state++; break; case 1: if (received=='i') state = state++; else state = 0; break; case 2: if (received=='r') state = state++; else state = 0; break; case 3: if (received=='e') printf("\n*FIRE!*\n"); state = 0; } } }
0 comments:
Post a Comment