← 返回 nvidia 的题目列表Validate Parentheses
类型:online_judge
Problem: Validate Parentheses String
Given a string s consisting only of characters ()[]{}, determine whether the brackets are properly matched and correctly nested.
Rules:
Every opening bracket must be closed by the same type of bracket.
Opening brackets must be closed in the correct order.
An empty string is considered valid.
Input (stdin)
One line containing the string s.
Output (stdout)
Print true or false.
Constraints
0 <= len(s) <= 1e5
Examples
Input: ()[]{} Output: true
Input: ([)] Output: false
Input: {[]} Output: true
Example
Input
()[]{}
Output
true