How to remove multiple spaces inside a String and just leave single space.
Eg: Input: "java on java"Output: "java on java"
Answer:
In Java, there is function replaceAll, we can simply use that as below, In C this was a bit cumbersome to do, but as they say, Java is Java. We can do it easy here.