This repository has been archived on 2021-10-31. You can view files and clone it, but cannot push or open issues or pull requests.
sys_prog/flipword/flipword.c

20 lines
344 B
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LINE_SIZE 1000
int main() {
char line[LINE_SIZE];
while(!feof(stdin)) {
fgets(line, LINE_SIZE, stdin);
size_t i = strlen(line) - 1;
if (line[--i] != '\n') {
putchar(line[i--]);
}
for (; i > 0; i--)
putchar(line[i]);
putchar(line[0]);
putchar('\n');
}
}