using System; namespace yukicoder { class Program { static void Main(string[] args) { var S = Console.ReadLine(); string[] strings = new string[S.Length] ; int Mcnt = 0, Icnt = 0, Ncnt = 0 , anscnt = 0; for(int i = 0; i < S.Length ; i++) { strings[i] = S.Substring(i , 1); } for(int j = 0; j < strings.Length ; j++) { if (strings[j] == "m") { Mcnt++; } else if (strings[j] == "i") { Icnt++; } else if (strings[j] == "n") { Ncnt++; } } for(int x = 0; x < strings.Length; x++) { if (Mcnt > 0 && Icnt > 0 && Ncnt > 0) { anscnt++; Mcnt--; Icnt--; Ncnt--; } else { Console.WriteLine(anscnt); break; } } } } }