2019-10-02 in class
This commit is contained in:
parent
6b4caa8223
commit
89ac20cdf0
1 changed files with 19 additions and 0 deletions
19
flipword.c
Normal file
19
flipword.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
#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');
|
||||
}
|
||||
}
|
Reference in a new issue