作者dasea2008 (own house engineering)
看板ncyu_phyedu
標題[討論] pro ncnp1998
時間Thu Jan 20 14:38:07 2011
98_NCC01-易] Parentheses Balance
成績: 0 / 倒扣: 0.8
Problem Description
[ ]. A string of this
type is said to be correct:
if it is the empty string,
if A and B are correct, AB is correct,
if A is correct, (A) and [A] is correct.
Write a program that takes a sequence of strings of this type and check their
correctness. Your program can assume that the maximum string length is 128.
Input File Format
The file contains a positive integer n and a sequence of n strings of
and [ ],one string a line.
Output Format
A sequence of Yes or No on the screen (standard output)
Example
Sample Input:
Sample Output:
3
([])
(([()])))
([()[]()])()
Yes
No
Yes
parentheses ()()andYou are given a string consisting of parentheses
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.130.189.43