A family of kookaburras are in my backyard.

I can't see them all, but I can hear them!

# How many kookaburras are there?




## Hint 

The trick to counting kookaburras is to listen carefully

* The males go ```HaHaHa```...

* The females go ```hahaha```...

* And they always alternate male/female



^ Kata Note : No validation is necessary; only valid input will be passed :-)

Difficulty: introductory

Starter code:

def kooka_counter(laughing):
	

Solutions:
import re

def kooka_counter(laughing):
    return len(re.findall(r'(ha)+|(Ha)+',laughing))

def kooka_counter(laughing):
    return 0 if laughing == '' else laughing.count('Hah') + laughing.count('haH') + 1

def kooka_counter(laughing):
    return laughing.count("Haha") + laughing.count("haHa") + bool(laughing)

import re

def kooka_counter(laughing):
    return len(re.findall(r'(Ha|ha)\1*', laughing))

import re

def kooka_counter(laughing):
    return len(re.findall(r'(Ha)+|(ha)+', laughing))

import re
def kooka_counter(stri):
    stri = re.sub(r"H+","H",stri.replace("a",""))
    stri = re.sub(r"h+","h",stri.replace("a",""))
    return len(stri)

import re

pattern = re.compile(r"(Ha)+|(ha)+")

def kooka_counter(laughing):
    return len(pattern.findall(laughing))

def kooka_counter(laughing):
    if len(laughing) == 0:
        return 0
    return laughing.count('haHa') + laughing.count('Haha') + 1

def kooka_counter(laugh):
    count = 0
    while laugh:
        pat = laugh[:2]
        laugh = laugh.lstrip(pat)
        count += 1
    return count

def kooka_counter(laughing):
  
  if len(laughing) == 0:
    return 0
  
  kooks = 1
  current = laughing[0]
  
  for i in range(2, len(laughing),2):
    if laughing[i] != current:
      current = current.swapcase()
      kooks += 1
  
  return kooks