#include <stdio.h>
#include <conio.h>
char reverse()
{
int counter=0, m=0, i=0;
char string[1000], ch;
while(ch!=27)
{
ch=getche();
string[i]=ch;
if(ch==13)
{
printf("\n");
for(m=i; m>=0; m--)
{
printf("%c", string[m]);
}
printf("\n");
i=-1;
}
i++;
}
}
int main()
{
printf("Enter data and press \'Esc\' when you complete typing.");
reverse();
getch();
}