fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.regex.*;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. String text = "PATRICK GOOD MAN";
  11. String result = text.replaceAll("(?<=\\S)\\s(?=\\S)","");
  12. System.out.println(result);
  13.  
  14. }
  15. }
Success #stdin #stdout 0.08s 33928KB
stdin
Standard input is empty
stdout
PATRICK   GOODMAN