Problem Description
In the most languages, the text is written from left to right. However, there is other languages where the text is read and written from right to left. As a first step towards a program this automatically translates from a left-to-right language into a right-to-left LANGUAG E and back, you is to write a program that changes the direction of a given text.
Input
The input contains several test cases. The first line contains an integer specifying the number of test cases. Each test case consists of a single line of the text which contains at the most characters. However, the newline character at the end of all line are not considered to being part of the.
Output
For each test case, print a line containing the characters of the input line in reverse order.
Sample Input
3
Frankly, I don ' t think we ' ll make much
Money out of the this scheme.
Madam I ' M Adam
Sample Output
Hcum Ekam ll ' ew kniht T ' nod I, Ylknarf
. Emehcs siht fo tuo yenom
Mada m ' I madam
is to enter a line of string, and then the reverse output can be ~
ImportJava.util.Scanner;/** * @author Chen Haoxiang * 2016-5-25 * * Public class Main{ Public Static void Main(string[] args) {Scanner SC =NewScanner (system.in);intT =sc.nextint (); Sc.nextline ();//Enter after reading the number while(t-->0) {String str =sc.nextline (); for(intI=str.length ()-1; i>=0; i--) {System.out.print (Str.charat (i)); } System.out.println (); } }}
Hdoj/hdu 1321 Reverse Text (Reverse output ~)