Datadog Interview Question

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