Skip to content

Instantly share code, notes, and snippets.

View PengFoo's full-sized avatar
🎯
Focusing

Peng Foo PengFoo

🎯
Focusing
  • Opera Inc.
  • Beijing
View GitHub Profile
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
@PengFoo
PengFoo / cutStr
Last active November 1, 2015 17:10
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