UBS interview question

Good string and bad string (leetcode problem)