s = 'ahaha'
curlen = maxlen = 0
prev = ''
for char in s:
if char in 'ha' and char is not prev:
curlen += 1
maxlen = max(maxlen, curlen)
else:
curlen = 0
prev = char
print(maxlen)
cyA9ICdhaGFoYScKCmN1cmxlbiA9IG1heGxlbiA9IDAKcHJldiA9ICcnCmZvciBjaGFyIGluIHM6CiAgICBpZiBjaGFyIGluICdoYScgYW5kIGNoYXIgaXMgbm90IHByZXY6CiAgICAgICAgY3VybGVuICs9IDEKICAgICAgICBtYXhsZW4gPSBtYXgobWF4bGVuLCBjdXJsZW4pCiAgICBlbHNlOgogICAgICAgIGN1cmxlbiA9IDAKICAgIHByZXYgPSBjaGFyCgpwcmludChtYXhsZW4p