Lexicographically Smallest Base String

Company: Rippling_23july

Difficulty: medium