learn string related syntax
From https://leetcode.com/problems/reverse-words-in-a-string-iii/#/description
public class Solution {
public String reverseWords(String s) {
String[] allStrings = s.split(" "); // ** returns String[]
StringBuilder ans = new StringBuilder();
for ( String ss : allStrings){
StringBuilder strB = new StringBuilder();
strB.append(ss);
strB.reverse();
ans.append(strB.toString() + " ");
}
String strAns = ans.toString(); // ** StringBuilder - toString() returns String
return strAns.substring(0, strAns.length() -1); // ** substring(from, to);
}
}