#include <stdio.h>
#include <string.h>
#include <malloc.h>

main() /* Ausgabe der Zeilen in umgekehrter Reihenfolge  */
{
    char *pvek[10000];
    char line[512];
    FILE *fpr;
    int i;

    i=0;
    while((fgets(line,512,stdin)) != NULL) {
        pvek[i]=malloc((unsigned) strlen(line));
        if(pvek[i] == NULL) {
              perror("malloc - no memory:");
              exit(1);
        }
        strcpy(pvek[i],line);
        i++;
    }
    while(--i >= 0) {
       printf("%s",pvek[i]);
       free(pvek[i]);
    }
}
