Get Optimal String

Company: Microsoft_17aug_dtu

Difficulty: medium