fork(1) download
  1. s = 'ahaha'
  2.  
  3. curlen = maxlen = 0
  4. prev = ''
  5. for char in s:
  6. if char in 'ha' and char is not prev:
  7. curlen += 1
  8. maxlen = max(maxlen, curlen)
  9. else:
  10. curlen = 0
  11. prev = char
  12.  
  13. print(maxlen)
Success #stdin #stdout 0.02s 9156KB
stdin
Standard input is empty
stdout
5