Word Reversal
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:32768KB
Total submit users: 31, Accepted users: 31
Problem 10040 : No special judgement
Problem description
Given a list of words, print the words reversed on separate lines. Each word consists of English letters only.
Input
The input consists of T test cases. The number of test cases (T) is given in the first line of the input file. Each test case consists of a single line, each line contains a word.
Output
For each test case, print the word reversed on one line.
Sample Input
2
HelloWorld
Madam
Sample Output
dlroWolleH
madaM
package cn.edu.hunnu.acm;
import java.util.Scanner;
public class Acm10040 {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int t = 0;
t = Integer.parseInt(cin.nextLine());
char[] word = null;
char[] reverseWord = null;
String lines = new String();
for(int i=0; i<t; i++){
lines = cin.nextLine();
word = reverseWord = new char[lines.length()];
word= lines.toCharArray();
int k=0;
for(int j=lines.length()-1; j>=0; j--){
reverseWord[k] = word[j];
k++;
}
System.out.println(reverseWord);
}
}
}
分享到:
相关推荐
USB Abstract Control Model driver for USB modems and ISDN adapters for Linux v2.13.6.
[74743.902036] cdc_acm 2-2.1:1.0: ttyACM0: USB ACM device [74743.903940] usbcore: registered new interface driver cdc_acm 那可能是因为少了这个——cdc-acm.ko 不要忘了加这个 sudo depmod -a 还有这个 ...
浙大ACM网站(acm.zju.edu.cn)上的部分题目的解题源码!推荐下载!
Algorithm-203-ACM-Problems-Code.zip,203个ACM问题的C 源代码,算法是为计算机程序高效、彻底地完成任务而创建的一组详细的准则。
acm.tju.edu.cn.rar
acm.timus.ru最全代码
acm.active contour module.可以直接使用,无需修改,opencv
The Art And Science Of Java Stanford 的JAVA公开课需要的acm.jar库,自己export的,可以用
资源分类:Python库 所属语言:Python 资源全名:mypy-boto3-acm-1.16.31.1.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
动态规划:http://acm.zju.edu.cn/forum/viewtopic.php?t=69 搜索:http://acm.zju.edu.cn/forum/viewtopic.php?t=67 数论:http://acm.zju.edu.cn/forum/viewtopic.php?t=66 几何:...
zju 1048 Financial Managementhttp://acm.zju.edu.cn/show_problem.php?pid=1048
ACM模板,较好地利用模板进行运用,很方便
acm.zju.com 中的 基因问题原代码-acm.zju.com the original genetic code issues
python库。 资源全名:mypy-boto3-acm-1.11.6.0.tar.gz
python库。 资源全名:mypy-boto3-acm-1.17.32.0.tar.gz
python库。 资源全名:mypy-boto3-acm-1.17.65.0.tar.gz
python库。 资源全名:mypy-boto3-acm-1.17.50.0.tar.gz
python库。 资源全名:mypy-boto3-acm-1.13.1.1.tar.gz
资源来自pypi官网。 资源全名:mypy-boto3-acm-1.16.38.0.tar.gz
资源来自pypi官网。 资源全名:mypy-boto3-acm-1.15.4.0.tar.gz