编程题:Balancing Symbols
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,
答案:若无答案欢迎评论
### 输入格式:
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,
答案:若无答案欢迎评论