#include<iostream>
#include<vector>
#include<assert.h>
#include<cstring>
usingnamespace
std;
voidswap(char
&a, char
&b)
{
chartmp = b;
b = a;
a = tmp;
}
voidswap_str(char* str,int
start, int
end)
{
assert(str!=NULL && start <= end);
intlow = start;
inthigh = end;
while(low < high)
{
swap(str[low], str[high]);
low++;
high--;
}
}
voidreverse_word(charstr[])
{
intlen =
strlen(str);
swap_str(str, 0, len-1);
ints = 0;
inte = 0;
for(int
i=0; i<len; i++)
{
e = i;
if(str[e] ==
' ')
{
swap_str(str, s, e-1);
s = e + 1;
}
}
}
int
main()
{
charstr[] =
"I am a student.";
reverse_word(str);
cout<<str<<endl;
return0;
}