コードテスト4番-単語反転

616 ワード

import java.util.Scanner;
  
public class Main {
  public static void main(String[] args){
	//민준 정답인데..??? 
	Scanner scan = new Scanner(System.in);
	
	int a = scan.nextInt() + 1;
	String []strs = new String[a];
	for(int i = 0; i < a ; i ++) {
		String str = scan.nextLine();
		strs[i] = str;
	}

	
	
	for(int i=0; i < strs.length ; i ++) {
		
		StringBuffer sb = new StringBuffer(strs[i]);
		System.out.println(sb.reverse().toString());
			
		
	}
  }
}
裏書き事項
StringBuffer sb = new StringBuffer(strs[i]);
System.out.println(sb.reverse().toString());
テキストを反転