1 import java.util.Scanner; 2 3 /** 4 * @author: yekai <br/> 5 * Date: 2021/11/15:21:46 <br/> 6 * Description:给定一个字符,将其逆序排列 7 */ 8 public class HJ106 { 9 public static void main(String[] args) { 10 Scanner sc = new Scanner(System.in); 11 String str = sc.nextLine(); 12 //字符逆序 13 char[] chars = str.toCharArray(); 14 for (int i = 0;i<=(chars.length-1)/2;i++){ 15 16 char temp = chars[i]; 17 chars[i] =chars[chars.length-1-i]; 18 chars[chars.length-1-i]=temp; 19 } 20 for (char c: 21 chars) { 22 System.out.print(c); 23 } 24 25 } 26 27 }