aa = (
    'booked#booked#available#available#available#available#available#booked#available#booked'
    )
words = aa.split('#')
for key, group in groupby(words):
    pass
Количество повторений подстроки в строке