public class Solution {
    public String ReverseSentence(String str) {
        if("".equals(str) || str.length() == 0) return "";
        String [] split = str.split(" ");
        String temp = "";
        for(int i = 0;i < split.length;i++){
            temp = temp + split[split.length - 1 - i];
            if(i != split.length - 1){
                temp = temp + " ";
            } 
        }
        return temp;
    }
}