Skip to content

Instantly share code, notes, and snippets.

@SathyaBhat
Created December 7, 2015 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SathyaBhat/02142ce322312b1943cb to your computer and use it in GitHub Desktop.
Save SathyaBhat/02142ce322312b1943cb to your computer and use it in GitHub Desktop.
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