1017: 字符串正反连接

来源:互联网 发布:hp5200网络打印机驱动 编辑:程序博客网 时间:2024/05/16 05:56

题目

Description

所给字符串正序和反序连接,形成新串并输出

Input

任意字符串(长度<=50)

Output

字符串正序和反序连接所成的新字符串

Sample Input

123abc
Sample Output

123abccba321

代码块

import java.util.Scanner;public class Main {    public static void main(String[] args) {        Scanner cin = new Scanner(System.in);        String string = cin.next();        StringBuffer tring = new StringBuffer(string);        tring.reverse();//利用Java的重置函数功能        System.out.println(string + tring.toString());        cin.close();    }}
0 0