while True:
registros = raw_input()
if registros[0] == '-':
break
i = 0
faltas = 0
while i < len(registros):
if registros[i] == 'f':
faltas += 1
i += 1
print faltas
#https://pt.stackoverflow.com/q/349204/101
d2hpbGUgVHJ1ZToKICAgIHJlZ2lzdHJvcyA9IHJhd19pbnB1dCgpCiAgICBpZiByZWdpc3Ryb3NbMF0gPT0gJy0nOgogICAgICAgIGJyZWFrCiAgICBpID0gMAogICAgZmFsdGFzID0gMAogICAgd2hpbGUgaSA8IGxlbihyZWdpc3Ryb3MpOgogICAgICAgIGlmIHJlZ2lzdHJvc1tpXSA9PSAnZic6CiAgICAgICAgICAgIGZhbHRhcyArPSAxCiAgICAgICAgaSArPSAxCiAgICBwcmludCBmYWx0YXMKCiNodHRwczovL3B0LnN0YWNrb3ZlcmZsb3cuY29tL3EvMzQ5MjA0LzEwMQ==