#include <stdio.h>
int main()
{
char string[500];
int len;
printf("Enter the input string\n");
scanf("%s",string);
len = strlen(string);
char *outputstr = (char *)malloc(len -2);
/** We can avoid this extra variable then we need one more integer to point
* the end of the string , so both are same 4 bytes */
char *substr = ((char *)string) + (len - 1);
len = 0;
/** Instead of while and strcat we can make single loop but that will
* modify the Source string , so made it two loop */
while(substr != string){
outputstr[len] = *substr;
substr--;
len++;
}
outputstr[len] = '\0';
strcat(outputstr,string);
printf("Out put string %s\n",outputstr);
}