#include <iostream>
#include <cctype>
std::istream& reverse_word(std::istream& in, std::ostream& out)
{
char ch;
if (in.get(ch) && !std::isspace(ch))
{
reverse_word(in, out);
out << ch;
}
return in;
}
int main()
{
for (unsigned i = 0; i < 5; ++i)
{
reverse_word(std::cin, std::cout);
std::cout << '\n';
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y2N0eXBlPgoKc3RkOjppc3RyZWFtJiByZXZlcnNlX3dvcmQoc3RkOjppc3RyZWFtJiBpbiwgc3RkOjpvc3RyZWFtJiBvdXQpCnsKICAgIGNoYXIgY2g7CiAgICAKICAgIGlmIChpbi5nZXQoY2gpICYmICFzdGQ6Omlzc3BhY2UoY2gpKQogICAgewogICAgICAgIHJldmVyc2Vfd29yZChpbiwgb3V0KTsKICAgICAgICBvdXQgPDwgY2g7CiAgICB9CgogICAgcmV0dXJuIGluOwp9CgppbnQgbWFpbigpCnsKICAgIGZvciAodW5zaWduZWQgaSA9IDA7IGkgPCA1OyArK2kpCiAgICB7CiAgICAgICAgcmV2ZXJzZV93b3JkKHN0ZDo6Y2luLCBzdGQ6OmNvdXQpOwogICAgICAgIHN0ZDo6Y291dCA8PCAnXG4nOwogICAgfQp9