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

#define SIZE 30

char* invertStr(const char *source)
{   
    int size = strlen(source);
    
    char *inverted = malloc(sizeof(source) * (size + 1));

    int count = size;

    for (int i = 0; i < size; i++)
    {
        inverted[i] = source[count];
        count--;
    }
    inverted[size + 1] = ('\0');

    return inverted;
}

int main(void)
{
    char str[SIZE];
    char str2[SIZE];

    scanf("%29s", str);

    char *inverted = invertStr(str);

    if (inverted == 0)
    {
        printf("NULL Pointer. Memory alocation error");

        return -1;
    }

    strcpy(str2, inverted);

    printf("%s | %s\n", str, str2);

    free(inverted);

    return EXIT_SUCCESS;
}