If we have reached the end of the string , return the subsequence if it is valid , else return an empty list
if index == len ( string ) : NEW_LINE INDENT if isValidSequence ( subList ) == True : NEW_LINE INDENT return subList NEW_LINE DEDENT else : NEW_LINE INDENT return [ ] NEW_LINE DEDENT DEDENT else : NEW_LINE