Problem Description

In most languages, text is written from left to right. However, there are other languages where text is read and written from right to left. As a first step towards a program that automatically translates from a left-to-right language into a right-to-left language and back, you are 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 text which contains at most 70 characters. However, the newline character at the end of each line is not considered to be part of the line.

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

就是输入一行字符串,然后倒序输出就可以了~

import java.util.Scanner;

/**
* @author 陈浩翔
* 2016-5-25
*/
public class Main{ public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t =sc.nextInt();
sc.nextLine();//读取数字后的回车
while(t-->0){
String str =sc.nextLine();
for(int i=str.length()-1;i>=0;i--){
System.out.print(str.charAt(i));
}
System.out.println();
}
}
}

HDOJ/HDU 1321 Reverse Text(倒序输出~)的更多相关文章

  1. HDOJ/HDU 1062 Text Reverse(字符串翻转~)

    Problem Description Ignatius likes to write words in reverse way. Given a single line of text which ...

  2. C#字符串的倒序输出

    介绍 在本文中,我将演示如何将字符串的单词倒序输出.在这里我不是要将“John” 这样的字符串倒序为成“nhoJ”,.这是不一样的,因为它完全倒序了整个字符串.而以下代码将教你如何将“你 好 我是 缇 ...

  3. Java基础知识强化08:将字符串倒序输出(包括空格)的几种方法

    1.最容易想到的估计就是利用String类的toCharArray(),再倒序输出数组的方法了: package himi.hebao05; public class TestDemo02 { pub ...

  4. Python中将一个对象倒序输出的4种方法

    Python中将一个对象倒序输出的4种方法就用列表来举例说明吧: >>> lst = [1,2,3,4,5,6] #创建测试列表 #方法1: >>> lst.rev ...

  5. java字符串实现正序和倒序输出

    ##一共4种方式 /*         * string倒序输出          * 利用String类的toCharArray(),再倒序输出数组的方法         * 2018-5-18 1 ...

  6. Java实现字符串倒序输出的几种方法

    1. 最容易想到的估计就是利用String类的toCharArray(),再倒序输出数组的方法了. import javax.swing.JOptionPane; public class Rever ...

  7. TJU Problem 1644 Reverse Text

    注意: int N; cin >> N; cin.ignore(); 同于 int N; scanf("%d\n",&N); 另:关于 cin 与 scanf: ...

  8. Java取出字符串中的大写字母,并倒序输出

    package catic.test; /** * @ClassName: TestXBQ * @Description: TODO 输出字符串中的大写字母,并倒序输出 * @author xbq * ...

  9. HDOJ(HDU).2844 Coins (DP 多重背包+二进制优化)

    HDOJ(HDU).2844 Coins (DP 多重背包+二进制优化) 题意分析 先把每种硬币按照二进制拆分好,然后做01背包即可.需要注意的是本题只需要求解可以凑出几种金钱的价格,而不需要输出种数 ...

随机推荐

  1. mysql的账户失效,之前的密码无法登录

     引用自:http://blog.sina.com.cn/s/blog_682c287b0100ofz8.html 此为linux服务器下的做法 方法一: 1.关闭mysql    # service ...

  2. oracle学习笔记2:创建修改表

    1.创建表 CREATE TABLE ORDERINFO ( ORDERID NUMBER(*, 0) NOT NULL , ORDERCODE VARCHAR2(20 BYTE) NOT NULL ...

  3. [uiview animation ...] 这个函数有多少没有认识的可能!翻盘效果 上下左右怎么翻都不怕

    1.自己还想着怎么3d 变形    让一个视图绕x/y 轴线翻转 就这么一句代码 [UIView transitionWithView:self.startButton duration:0.5 op ...

  4. Flex:CSS3布局利器

    实习以来做了三个小控件,都是用的CSS2.1里传统的DIV+CSS布局方式,综合使用position.margin.float.BFC等属性或特性将元素放到指定的位置上.然而面对日益复杂的界面,这些来 ...

  5. SSH整合笔记

    SSH:spring+struts+hibernate. 一:所需jar: 需要注意的是: hibernate+spring需要Spring-orm-xxx.jar struts+spring需要st ...

  6. 171. Excel Sheet Column Number(C++)

    171. Excel Sheet Column Number Related to question Excel Sheet Column Title Given a column title as ...

  7. linux自定义开机启动服务

    转 http://www.cnblogs.com/jimeper/archive/2013/03/12/2955687.html 手工创建服务 1.在/etc/rc.d/init.d目录下创建shel ...

  8. web服务器的卸载

     在卸载这三个应用之前,咱们可以在终端通过运行“dkpg -l”来查看软件状态. 方法一:选择dpkg -P来卸载软件. 因为dpkg --remove只是删除安装的文件,但不删除配置文件.而dpkg ...

  9. MOOC即Massive Open Online Course的缩写

    A man can succeed at almost anything for which he was unlimited enthusiasm. 只要有无限的热情,一个人几乎可以在任何事情上取得 ...

  10. 受教了,memcache比较全面点的介绍,受益匪浅,适用memcached的业务场景有哪些?memcached的cache机制是怎样的?在设计应用时,可以通过Memcached缓存那些内容?

    基本问题 1.memcached的基本设置 1)启动Memcache的服务器端 # /usr/local/bin/memcached -d -m 10 -u root -l 192.168.0.200 ...