#include
#define N 100
int main()
{
int i, j, cnt;
char ch, end;
char sentence[N];
printf("Enter a sentence: ");
i = 0;
while (1)
{
ch = getchar();
if (ch == '.' || ch == '!' || ch == '?')
break;
sentence[i++] = ch;
}
end = ch;
i--;
printf("Reserval of sentence: ");
while (i >= 0)
{
for (cnt = 0; (i >= 0) && (sentence[i] != ' '); i--, cnt++)
;
for (j = i + 1; cnt > 0; cnt--)
printf("%c", sentence[j++]);
if (i > 0)
printf(" ");
i--;
}
printf("%c\n", end);
return 0;
}