HDOJ/HDU 1321 Reverse Text(倒序输出~)

简介: HDOJ/HDU 1321 Reverse Text(倒序输出~)

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();
        }
    }
}
目录
相关文章
|
6月前
|
存储 供应链 监控
供应链复杂、工厂分散,半导体行业如何安全访问总部ERP系统?
电子元器件与半导体行业面临供应链复杂、生产计划多变等挑战,智能化ERP系统成为提升效率的关键。然而,数据安全至关重要,许多企业选择本地部署并结合内网穿透技术实现远程访问。以神州讯盟ERP为例,搭配贝锐花生壳,无需公网IP即可安全接入总部系统。花生壳采用多重加密与权限控制,保障数据传输安全,同时支持高速跨地区访问,仅需三步即可完成配置,满足多地协同办公需求,助力企业高效管理。
142 0
|
8月前
|
存储 自然语言处理 自动驾驶
基于LLM打造沉浸式3D世界
阿里云数据可视化产品DataV团队一直在三维交互领域进行前沿探索,为了解决LLMs与3D结合的问题,近期在虚幻引擎内结合通义千问大模型家族打造了一套基于LLM的实时可交互3D世界方案,通过自然语言来与引擎内的3D世界进行交互。
862 160
|
Android开发 Kotlin
安卓Jetpack Compose+Kotlin, 使用ExoPlayer播放多个【本地】音频,播放完随机播放下一首,遇到播放错误,也自动播放下一首
使用Kotlin和Jetpack Compose开发的安卓应用中,实现了两个EvoPlayer同时播放res/raw目录下的音频。一个音轨播放人声(顺序播放),另一个播放背景音乐(随机播放)。每个音轨都有独立的播放和停止控制,且在播放结束或遇到错误时会自动切换到下一首。MediaPlayer置于ViewModel中,UI界面包含播放和停止按钮,控制两个音轨。每次切换音频前,还会随机调整播放速度在0.9到1.2之间。代码示例展示了如何创建ViewModel和UI以实现这一功能。
|
网络安全
Managed Node
【8月更文挑战第4】
77 7
ElementPlus的el-table-column如何添加超链接的代码
ElementPlus的el-table-column如何添加超链接的代码
|
机器学习/深度学习 数据采集 消息中间件
|
消息中间件 负载均衡 监控
Kafka消费者:监听模式VS主动拉取,哪种更适合你?
Kafka消费者:监听模式VS主动拉取,哪种更适合你?
697 0
|
算法 Java 测试技术
华为OD:求字符串中所有整数的最小和
华为OD:求字符串中所有整数的最小和
378 0