APS.04 String MatchingFrom naïve O(nm) to KMP O(n+m): prefix function, rolling hash, and binary search on longest repeated substring.