UBS Interview Question

Good string and bad string (leetcode problem)