import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int n;
Scanner in = new Scanner(System.in);
n = in.nextInt();
in.nextLine();
while (n-->0) {
// System.out.println("----------------------");
StringBuffer s = new StringBuffer(in.nextLine());
StringBuffer temp = new StringBuffer();
temp.setLength(0);
for (int i = 0; i<s.length(); i++) {
if(s.charAt(i) != ' ')
temp.append(s.charAt(i));
else if(temp.length()>0){
System.out.print(temp.reverse()+" ");
temp.setLength(0);
}
}
System.out.print(temp.reverse());
temp.setLength(0);
if(n>0){
System.out.println();
}
}
}
}
上面的程序PE错误。why???