insidcode
ProblemsDuelLeaderboardStats
Sign In
  1. Home
  2. Problems
  3. Verify whether parentheses `()`, `{}`, `[]` in a string are properly balanced (using an array as a stack).

Verify whether parentheses `()`, `{}`, `[]` in a string are properly balanced (using an array as a stack).

Difficulty: Hard

Phase: 6 · Mixed Logical Challenges

XP Reward: 30 XP

Topics: Mixed Logical Challenges, Hard

Supported Languages: Python, JavaScript, C, C++, Java

Problem Description

Given string of bracket characters, verify if parentheses (), {}, [] are properly balanced. Print 'Valid' or 'Invalid'. Input Format: Read input from standard input (stdin). Output Format: Print the result to standard output (stdout).

Constraints

  • -10^9 <= N <= 10^9

Examples

Example 1

Input: {[()]}

Output: Valid

Explanation: Sample execution for input {[()]}