Implement a custom substring matching algorithm to find specific patterns within a stream of ad telemetry data.