fork download
  1. import java.util.regex.Matcher;
  2. import java.util.regex.Pattern;
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. class Ideone
  8. {
  9. public static void main (String[] args) throws java.lang.Exception
  10. {
  11. // your code goes here
  12. String in = "111111111111111";
  13. Pattern p = Pattern.compile("1(?=1111)");
  14. Matcher m = p.matcher(in);
  15. while (m.find()) {
  16.  
  17. System.out.print(m.start() + " ");
  18.  
  19. }
  20.  
  21. }
  22. }
Success #stdin #stdout 0.04s 2184192KB
stdin
Standard input is empty
stdout
0 1 2 3 4 5 6 7 8 9 10