Problem Description
給予一個英文字母與數字參雜的字串,長度限制在 256 個字母內。請撰寫一程式輸出此字串的迴文字串。
Input File Format
輸入分為兩部份,第一行是介於 1 到 99 的數字,表示接著有幾個要輸入的字串。第二部份是所要改變的字串,每個字串單獨佔一列。
Output Format
經轉換後的迴文字串。
Example
題目來源:http://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?id=469
import java.util.Scanner;
public class C_ST02 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int num=Integer.parseInt(scanner.nextLine());
for(int i=0;i<num;i++){
String a=scanner.nextLine();
for(int j=a.length()-1;j>=0;j--){
System.out.print(a.substring(j, j+1));
}
System.out.println();
}
scanner.close();
}
}