Created
December 7, 2015 08:15
-
-
Save SathyaBhat/02142ce322312b1943cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stairs = input("Paste your input") | |
n = 0 | |
position = 0 | |
for s in stairs: | |
position += 1 | |
if s == '(': | |
n += 1 | |
elif s == ')': | |
n -= 1 | |
if n == -1: | |
break | |
print("Position: {}".format(position)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment