蓝桥杯 ALGO-58 算法训练 字串逆序

来源:互联网 发布:手机游戏双开软件 编辑:程序博客网 时间:2024/06/02 14:29
问题描述
  给定一个字符串,将这个串的所有字母逆序后输出。
输入格式
  输入包含一个字符串,长度不超过100,字符串中不含空格。
输出格式
  输出包含一个字符串,为上面字符串的逆序。
样例输入
tsinsen
样例输出

nesnist

import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner in = new Scanner(System.in);StringBuffer str = new StringBuffer();str.append(in.nextLine());System.out.println(str.reverse());in.close();}}


原创粉丝点击