1097: 字符串问题

题目

Description

字符串处理在计算机中有很多复杂的操作,但是这些复杂的操作都是由基本的字符串操作复合而成,要求编写一字符串颠倒的程序,把字符串中的字符颠倒位置。

Input

输入一字符串(<255)

Output

按位进行颠倒的结果。

Sample Input

COMPUTER
Sample Output

RETUPMOC


代码块

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner cn = new Scanner(System.in);
        String str = cn.nextLine();
        System.out.println(new StringBuilder(str).reverse().toString());//这里是使用的是jdk提供的StringBuilder提供的方法
    }
}

你可能感兴趣的:(acm编程)