import java.util.*;
public class Transform {
    public String trans(String s, int n) {
        // write code here
        s = s.substring(0,n);
        String[] temp = s.split(" +");
        StringBuilder res = new StringBuilder();
        char tempChar;
        for (int i = temp.length-1; i >= 0 ;i--){
            for (int j = 0; j < temp[i].length() ; j++){
                tempChar = temp[i].charAt(j);
                if (Character.isLowerCase(tempChar))
                    res.append(Character.toUpperCase(tempChar));
                else if (Character.isUpperCase(tempChar))
                    res.append(Character.toLowerCase(tempChar));
            }
            if (i!=0)
                res.append(" ");
        }
        return res.toString();
    }
}
求问第一题代码哪里错了。。一直不能AC。。第三题也是_(:зゝ∠)_