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. 在fragment中调用SharedPreferences

    [o] Activity中调用SharedPreferences的方式: String prefsName = "mysetting"; SharedPreferences pre ...

  2. leetcode中一些要用到动态规划的题目

    需要仔细回顾的题目: 1.Interleaving String   交叉存取字符串 2.Decode Ways   字符串解码 3.Subsets   Subsets II          求一个 ...

  3. PowerDesigner 的几个使用技巧

    1.  生成sql脚本 Database→Generate Database 选择要输出的文件路径,即文件存储路径,并根据需要修改文件名,单击确定后便会生成sql脚本.   在Options选项卡里, ...

  4. jQuery插件综合应用(三)发布文章页面

    一.使用的插件 一个折叠的功能导航,由Akordeon插件实现.Nanoscroller插件与Tagit插件主要用于美化页面.这里只是测试,其实还可以综合使用其它的插件,例如将Akordeon插件换成 ...

  5. 使用JsPlumb绘制拓扑图的通用方法

    转自:http://www.it165.net/pro/html/201311/7616.html 使用JsPlumb绘制拓扑图的通用方法 一. 实现目标 绘制拓扑图, 实际上是个数据结构和算法的问题 ...

  6. css3多行省略号

    -webkit-line-clamp 概述: -webkit-line-clamp 是一个 不规范的属性(unsupported WebKit property),它没有出现在 CSS 规范草案中. ...

  7. node 后台ajax文件(同时支持http、https)

    var http = require("http"), Url = require("url"), querystring = require('queryst ...

  8. svn服务器时间与本地时间不同步解决

    在用svn的时候,由于svn的时间与本地不同步,导致每次看log总是需要对时间. 今天修改了svn服务器时间与本地同步.只需要修改svn服务器时间与本地时间相同即可,但要主要修改时区,不然会出现时间又 ...

  9. Socket 错误总结

    错误 因为并没有搞清楚accept函数的使用,所以导致不停的发送失败,同时还不知道错误在哪里,无意中看见errno这个库,可以记录错误的原因,才知道原因在于没有用客户端的套接字进行接收数据,而这个客户 ...

  10. classpath目录

    WEB-INF/ 是资源目录, 客户端不能直接访问, 这话是没错,不过现在的IDE编译器在编译时会把src下的文件(是文件,不是.java)移到WEB-INF/classes下.不过值得注意的是,sp ...