Longest Substring Matching Regex Pattern

Company: Amazon_july

Difficulty: medium