We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ca5489d commit 74fab70Copy full SHA for 74fab70
53-multiple-bracket.py
@@ -0,0 +1,15 @@
1
+def MultipleBrackets(str):
2
+ count = 0
3
+ countList = []
4
+ for i in str:
5
+ if i == "(" or i == "[":
6
+ count += 1
7
+ countList.append(i)
8
+ elif i == ")" or i == "]":
9
+ if countList.pop() != ("(" if i == ")" else "["):
10
+ return 0
11
+ return "%d %d" %(1, count) if len(countList) == 0 else 0
12
+
13
+# keep this function call here
14
+# to see how to enter arguments in Python scroll down
15
+print MultipleBrackets(raw_input())
0 commit comments