#include /* line output frequency */ const int DIVISOR = 2; int main() { char c; char newline = 1; /* a flag to mark newlines */ char line_num = 0; while (scanf("%c", &c)) { /* quit when 'Q' is met right after a newline */ if (c == 'Q' && newline) break; /* Check to see whether to output this character or not */ if (line_num % DIVISOR == 0) printf("%c", c); /* mark a new line */ newline = (c == '\n') ? 1 : 0; if (newline) line_num++; } return 0; }