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

PROGRAMMING:Balancing Symbols

Luz1个月前 (05-10)题库11
Check a section of C code if the parenthesis ( ), brackets [ ], and braces { } are balanced. For simplicity, there is only ONE line in the code.
### Input Specification:
Each input file contains one test case. For each case, there is only ONE line of a section of C Programming Language code containing no more than 1000 character ending with a `\n` .
### Output Specification:
For each test case, print the number of opening symbols and the number of closing symbols in the first line with one space between them. And in the second line print YES if there is no mismatching in the code, or print NO if the symbols mismatch.
### Sample Input 1:
```in
for(int i=0; iAdj[i][j])); }
```
### Sample Output 1:
```out
8 8
YES
```
### Sample Input 2:
```
for(int i=0; i```
### Sample Output 2:
```
2 2
NO
```






answer:If there is no answer, please comment
分享给朋友:

发表评论

访客

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