S = input() l = list(S) mi_ck = 0 count = 0 for i in range(len(l)): if l[i] == "m" and l[i + 1] =="i": mi_ck = 1 if l[i] == "n" and mi_ck == 1: mi_ck = 0 count += 1 print (count)