Sign In Required

You need to sign in to access this feature and track your progress.

Easy

Valid Parentheses

Topic: Stacks • Acceptance: 80%
Given a string `s` containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if open brackets are closed by the same type of brackets and in the correct order.

Input Format:

A single line string s.

Output Format:

Print 'true' if valid, otherwise 'false'.

Sample Example:

Sample Input:
()[]{}
Sample Output:
true
Sandboxed Engine

Ready to test. Click Test All Cases or Submit Solution to evaluate your code.

Code Playground Cloud Sandbox PYTHON
// Code Playground Cloud Execution Engine v2.4
// Write your code and click 'Run Code' to execute.
$ ready
Standard Input (stdin):
Your code can read standard input via stdin.