import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.*;
import java.lang.*;
import java.io.*;
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
String in = "111111111111111";
Pattern p = Pattern.compile("(11111)");
Matcher m = p.matcher(in);
while (m.find()) {
System.out.print(m.start() + " ");
}
}
}
The output of the above code I am getting is
0 5 10
The output I should be getting is
0 1 2 3 4 5 6 7 8 9 10
Can somebody tell me what I am doing wrong?