I have written the code which is too lengthy:
main()
{
char strEnter[100];
char strGet[100];
cout<<"Enter any string:";
gets(strEnter);
int counter=0;
int length=strlen(steEnter)-1;
while(length>=0)
{
if(strEnter[length]==' ')
{
for(int i=length+1;strEnter!=null;i++)
{
strGet[counter++]=strEnter[i];
}
strGet[counter++]=' ';
strEnter[length]='\0';
}
length--;
}
int length1=strlen(strEnter)-1;
for(int j=0;strEnter!=null;j++)
{
strGet[counter++]=strEnter[j];
}
strGet[counter]='\0';
puts(strGet);
}