Skip to content

Instantly share code, notes, and snippets.

@PengFoo
Last active November 1, 2015 17:10
Show Gist options
  • Save PengFoo/d23670338bfb4f517b42 to your computer and use it in GitHub Desktop.
Save PengFoo/d23670338bfb4f517b42 to your computer and use it in GitHub Desktop.
def find(s):
res,start,cur = [],1,s[0]
for index,i in enumerate(s):
if i != cur:
res.append((start,index))
start = index + 1
cur = i
res.append((start,len(s)))
return res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment