I wrote the following a java by using a regular expression to find a repeated String in the String s
. Now I try to find the complexity of it, if any one know what is the complexity of it, please let me know.
String s = "ABCABCAAAABBBBCCAAABCGABCABC";
Pattern pattern = Pattern.compile("(?:([ABC])(?!\\1)([ABC])\\1\\2)+");
Matcher matcher = pattern.matcher(s);
while (matcher.find()) {
System.out.print("FOUND");
}