Python

#recursion

def count_z(txt):
    if len(txt) == 0:
        return 0
        
   remaining_chars = count_z(txt[1:])
    if txt[0] == 'z':
       return 1 + remaining_chars
    
    return remaining_chars

txt = 'xyzabzbzzbzzzt'
assert count_z(txt) == 7