Answers for "reverse sentence in java"

0

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);
Posted by: Guest on March-06-2021

Code answers related to "reverse sentence in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language