reverse the sentence in java code example
Example: reverse sentence in java
// INPUT: "you shall not pass"
// OUTPUT: "pass not shall you"
String s[] = "you shall not pass".split(" ");
String ans = "";
for (int i = s.length - 1; i >= 0; i--) {
ans += s[i] + " ";
}
System.out.println(ans);