Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', how would you determine if the input string is valid? A string is valid when every opening bracket is closed by the same bracket type and brackets close in the correct order. Implement def is_valid(s): and return a boolean.
Input is a string containing only the six bracket characters. Return True for valid nesting and False otherwise.
def is_valid(s):