Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
public String reverseWords(String s) {
if (s == null || s.length() <= 1) {
return s;
}
String res = "";
String[] words = s.trim().split(" +");
for (int i = words.length - 1; i >= 0; i--) {
res += words[i] + " ";
}
return res.trim();
}