Valid Parentheses

Medium 40 XPStringsStack

Commonly asked at Amazon, Google, Microsoft, Facebook

Read a string containing only ()[]{}. Print Valid if every bracket is closed by the same type in the correct order, otherwise Invalid.

Input
One line of brackets.
Output
Valid or Invalid.

Sample 1

Input

{[()]}

Output

Valid

Sample 2

Input

([)]

Output

Invalid

Read input with input() (no prompt message) and print only the answer. Run tries the Input box; Submit checks all test cases.

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.
The solution unlocks after 3 submissions.