s = input() pattern = ["m","i","n"] index=0 for si in s: if si==pattern[(index%3)]: index+=1 print(index//3)