Longest Valid Substring

Company: Microsoft_10sep

Difficulty: medium