fork(2) download
  1. import java.util.regex.*;
  2.  
  3. class Ideone {
  4. public static void main (String[] args) throws java.lang.Exception {
  5. Pattern p = Pattern.compile("(.)(?=((?!\\1).)*\\1(?!.*\\1))");
  6.  
  7. for (Matcher m = p.matcher("abacaba dx xyzzzyy"); m.find(); ) {
  8. System.out.print(m.group());
  9. }
  10. }
  11. }
Success #stdin #stdout 0.1s 27780KB
stdin
Standard input is empty
stdout
ba xzy