I want only one space in output between every word no matter how much spaces between the words in input. But in following code spaces in output between love and java same as input spaces.
public class Main {
public static void main(String[] args) {
String s = "I love java programming.";
String ss[] = s.split(" ");
for (int i = ss.length - 1; i >= 0; i--) {
System.out.print(ss[i] + " ");
}
}
}
Output:--
programming. java love I