Given a string containing only (, ), {, }, [ and ], determine if the given string is valid.
A string is valid if it is closed by the same type of brackets and closed in correct order.
- input
()returnstrue - input
(){}[]returnstrue - input
(}returnsfalse - input
({)}returnsfalse - input
{[]}returntrue