Not an official ACM page
[Problem E | 1994 Western European Regional problem set | My ACM problem archive | my home page]

1994-1995 ACM International Collegiate Programming Contest
Western European Regional
Practice Session

Problem D

Reverse

As you may know, in most languages, texts are written from left to right. However, exceptions exist, in which case people read from right to left (e.g. Hebrew).

Having heard about this phenomenon, and always willing to make a few bucks, John believes that he can aid the translation business by making a preprocessor for translation from left-to-right languages to right-to-left languages. The way John sees it, if we would reverse the normal text line by line, half of the work has been done.

Unfortunately, John never got around actually writing the program, since he got involved in an even more promising project involving Unicorns.

Maybe you can write this program for him.

Input Specification

The first line of input is an integer N specifying the number of test cases. Each test case consists of a single line, where each line is no longer than 80 characters. The newline is not considered to be part of the line itself.

Output Specification

For each test case, print on a single line the characters of the input line in reverse order.

Example Input

3
Frankly, I don't think we'll make much
money out of this scheme.
madam I'm adam

Example Output

hcum ekam ll'ew kniht t'nod I ,ylknarF
.emehcs siht fo tuo yenom
mada m'I madam

This page maintained by Ed Karrels.
Last updated November 11, 1997