Generate strings with a specified pattern -- Google(Recursive)