#include typedef struct { int restart, g, b; char ch; } Fmt; void comain( Fmt * f ) { static void * states[] = {&&s0, &&s1}; goto *states[f->restart]; s0: f->restart = 1; for ( ;; ) { for ( f->g = 0; f->g < 5; f->g += 1 ) { // groups for ( f->b = 0; f->b < 4; f->b += 1 ) { // blocks do { return; s1: ; } while ( f->ch == '\n' ); // ignore printf( "%c", f->ch ); // print character } printf( " " ); // block separator } printf( "\n" ); // group separator } } int main() { Fmt fmt = { 0 }; comain( &fmt ); // prime for ( ;; ) { scanf( "%c", &fmt.ch ); // direct read into communication variable if ( feof( stdin ) ) break; comain( &fmt ); } if ( fmt.g != 0 || fmt.b != 0 ) printf( "\n" ); } // Local Variables: // // tab-width: 4 // // compile-command: "gcc-8 Format.c" // // End: //