Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
spoj ANARC09A
braces = input().rstrip() i = 1 while '-' not in braces: c = 0 stack = [] for token in braces: if len(stack): if token == '}': if stack.pop() == token: c += 1 else: stack.append(token) else: stack.append(token) if len(stack): c += len(stack) // 2 if stack[0] == '}': c += 1 print("%d. %d" % (i, c)) i += 1 braces = input().rstrip()
run
|
edit
|
history
|
help
0
Lesson 9 hw
Sending email from python
19.09.18
Gauss
sept
My first experience on rextester !
Set
Contact Class 2.0
Transpose matrix
15