#include <iostream.h>
#include <boost/scoped_array.hpp>
void reverse(char *str, unsigned int n)
{
if (n < 2) return;
int x = 0;
unsigned int nn = n >> 1;
while (n > nn)
{
--n;
char c = str[x];
str[x] = str[n];
str[n] = c;
x++;
}
}
std::string reverse(const std::string &str)
{
int t = str.size();
char *c = new char[t + 1];
boost::scoped_array<char> copy(c);
str.copy(c, t);
reverse(c, t);
copy[t] = '\0';
return c;
}
int main()
{
std::string r = reverse("collaboration");
std::cout << r << std::endl;
return 0;
}