fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.regex.Matcher;
  7. import java.util.regex.Pattern;
  8.  
  9. /* Name of the class has to be "Main" only if the class is public. */
  10. class Ideone
  11. {
  12. public static void main (String[] args) throws java.lang.Exception
  13. {
  14. String text = "L[0] = new Array('S','O','L','O','M','I','L','L','O','','B','I','B','L','I','O','','C','A','O');\r\n"
  15. + "L[1] = new Array('A','R','T','R','O','S','E','','D','I','N','A','M','I','T','E','','E','U','');\r\n"
  16. + "L[2] = new Array('R','C','P','','R','I','C','A','','','','','','','','','','','','');\r\n"
  17. + "L[3] = new Array('R','A','','','A','S','A','','A','N','O','R','M','L','','P','U','T','I','N');\r\n"
  18. + "L[4] = new Array('O','','','','T','','','','','','','','','','','','','','','');\r\n"
  19. + "L[5] = new Array('','','','','O','','','','','','','','','','','','','','','');";
  20. text = text.replace("''", "' '");
  21.  
  22. Pattern p = Pattern.compile("'([A-Z ])'");
  23. StringBuilder sb = new StringBuilder();
  24.  
  25.  
  26.  
  27. for (String line : text.split("\\R")) {//since Java 8 \R can be used to represent line separators
  28. Matcher m = p.matcher(line);
  29. while (m.find()) {
  30. sb.append(m.group(1));
  31. }
  32. sb.append(' ');
  33. }
  34. String str = sb.toString().trim().replaceAll("\\s{2,}", " ");
  35.  
  36. System.out.println(str);
  37. }
  38. }
Success #stdin #stdout 0.1s 320256KB
stdin
Standard input is empty
stdout
SOLOMILLO BIBLIO CAO ARTROSE DINAMITE EU RCP RICA RA ASA ANORML PUTIN O T O