#include #define NL(x) if(c=='\n') goto NewLine; if(c==EOF) goto F; if(c=='t') goto T##x #define B(x) if(c==' ') goto Blank##x #define G(a,b) if(c==a) goto b #define G1(A,B) if((scanf("%c",&c),c)==A) goto B #define X1 goto One #define X2 goto Two #define X3 goto Three #define Z(A,BB,CC) \ A##1: if ((scanf("%c",&c),c)==BB) goto CC##2; if(c=='\n') goto NewLine; \ if (c==EOF) goto F; if (c=='t') goto T2; \ if (c==' ') goto Blank1; goto Two; \ A##2: if ((scanf("%c",&c),c)==BB) goto CC##3; if(c=='\n') goto NewLine; \ if (c==EOF) goto F; if (c=='t') goto T3; \ if (c==' ') goto Blank2; goto Three; \ A##3: if ((scanf("%c",&c),c)==BB) goto CC##1; if(c=='\n') goto NewLine; \ if (c==EOF) goto F; if (c=='t') goto T1; \ if (c==' ') goto Blank3; goto One int main(void) { int c; // vstupni znak NewLine: // novy radek G1(EOF,F); G('q',Dumb); G('t',T2); NL(2); B(1); X2; One: G1('t',T2); NL(2); B(1); X2; // zacatek cteni Two: G1('t',T3); NL(3); B(2); X3; Three: G1('t',T1); NL(1); B(3); X1; Z(T,'f',Tf); // precteno t Z(Tf,'u',Tfu); // precteno f Z(Tfu,'j',Tfuj); // precteno u Z(Tfuj,'t',Tfujt); // precteno j Tfujt1: G1('a',Tfujta2); G('f',Tf2); NL(2);B(1);X2; // osetreni f Tfujt2: G1('a',Tfujta3); G('f',Tf3); NL(3);B(2);X3; Tfujt3: G1('a',Tfujta1); G('f',Tf1); NL(1);B(3);X1; Z(Tfujta,'j',Tfujtaj); // precteno j Z(Tfujtaj,'x',Tfujtajx); // precteno x Z(Tfujtajx,'l',Tfujtajxl); // precteno l Tfujtajxl1: G1('\n',TRUE); G(EOF,TRUE); G(' ',OK1); goto Tfujtajxl2; Tfujtajxl2: G1('\n',NewLine); G(' ',OK2); G('*',F); goto Tfujtajxl3; Tfujtajxl3: G1('\n',NewLine); G(' ',OK3); G('*',F); goto Tfujtajxl1; // precten tfujtajxl, cteni do konce radky OK1: G1('q',Dumb); if (c=='\n'||c==EOF) goto TRUE; G(' ',OK1); goto Tfujtajxl2; OK2: G1('q',Dumb); G('\n',NewLine); G(' ',OK2); G('*',F); goto Tfujtajxl3; OK3: G1('q',Dumb); G('\n',NewLine); G(' ',OK3); G('*',F); goto Tfujtajxl1; Blank1: G1('q',Dumb); NL(2);B(1); X2; // nacteni mezery Blank2: G1('q',Dumb); NL(3);B(2); X3; Blank3: G1('q',Dumb); NL(1);B(3); X1; Dumb: G1('*',F); G('\n',NewLine); goto Dumb; // cteni do konce radky TRUE: printf("Zaklinadlo nalezeno\n"); return 0; F: printf("Zaklinadlo nebylo nalezeno\n"); return 0; }