Hdoj/hdu 1321 Reverse Text (Reverse output ~)

Source: Internet
Author: User
Tags reverse text

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 ~)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.