Datadog interview question

Implement an algorithm that computes results for a simplified regex expression.