Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #define f(i, s, t) for (int i = s; i < t; ++i)
- #define fd(i, t, s) for (int i = t; i >= s; --i)
- int main() {
- int n; scanf("%d", &n);
- size_t size = 110;
- char * p = (char*)malloc(size*sizeof(char));
- getline(&p, &size, stdin);
- f(i,0,n) {
- getline(&p, &size, stdin);
- p[strlen(p)-1] = '\n';
- int a = strlen(p)/2, b = strlen(p) - a;
- fd(j, a-1, 0) {
- printf("%c", p[j]);
- }
- fd(j, strlen(p)-2, b-1) {
- printf("%c", p[j]);
- }
- printf("\n");
- }
- free(p), p = NULL;
- }
Add Comment
Please, Sign In to add comment