fork(1) download
  1. class Idiom219ReplaceMultipleSpacesWithSingleSpace {
  2. public static void main(String[] args) {
  3. var s =
  4. "q w e r t \n" +
  5. "\n" +
  6. "\n" +
  7. "y";
  8.  
  9. String t = s.replaceAll(" +", " ");
  10. System.out.println(t);
  11. }
  12. }
Success #stdin #stdout 0.08s 51892KB
stdin
Standard input is empty
stdout
q w e r t 


y