import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); // 注意 hasNext 和 hasNextLine 的区别 int a = in.nextInt(); for(int i = 0; i < a; i++){ int l = in.nextInt(); //第一个nextLine()为了吃掉nextInt()后的回车符 String str1 = in.nextLine(); String str = in.nextLine().trim(); char[] c = str.toCharArray(); StringBuffer newStr = new StringBuffer(); for (char c1 : c) { if(c1 != ' '){ newStr.append(c1); } } char[] c2 = newStr.toString().toCharArray(); for(int j = c2.length; j > 0; j--){ System.out.print(c2[j - 1]); } System.out.print("\n"); } } }