-->
当前位置:首页 > 题库 > 正文内容

编程题:Balancing Symbols

Luz4年前 (2021-10-14)题库933
Balancing symbols: Check if parenthesis (), brackets[], and braces{} are balanced.

### 输入格式:

1 line
An expression includes variables and symbols. The max length is 50.

### 输出格式:

1 line
If all the () [] {} are balanced, then output 0.
If () are not balanced, output 1; If [] not balanced, output 2; If {} not balance, output 3.
If more than one symbol are not balanced, output corresponding numbers, sort them in ascending order and divided them by comma.

### 输入样例:

在这里给出一组输入。例如:

in
{a*(b-c)-x/2]



### 输出样例:

在这里给出相应的输出。例如:

out
2,3,








答案:若无答案欢迎评论

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。