Alice likes word "nineteen" very much. She has a string *s* and wants the string to contain as many such words as possible. For that reason she can rearrange the letters of the string.

For example, if she has string "xiineteenppnnnewtnee", she can get string "xnineteenppnineteenw", containing (the occurrences marked) two such words. More formally, word "nineteen" occurs in the string the number of times you can read it starting from some letter of the string. Of course, you shouldn't skip letters.

Help her to find the maximum number of "nineteen"s that she can get in her string.
The first line contains a non-empty string *s*, consisting only of lowercase English letters. The length of string *s* doesn't exceed 100.
# -*- coding:utf-8 -*-
def Nineteen(s: str) -> int:
    # write code here
    # record the appearance times of n,i,e,t
    # n:3,i:1,e:3,t:1
    # use a list to record it is more simple, but here record it directly
    # n_num=0
    # i_num=0
    # e_num=0
    # t_num=0
    strs = "niet"
    str_len = len(strs)
    str_divide_times = [3, 1, 3, 1]
    nums = [0 for _ in range(str_len)]
    for ch in s:
        pos = strs.find(ch)
        if pos != -1:
            nums[pos] += 1
    min_times = -1
    for no, cur_nums in enumerate(nums):
        if strs[no] == 'n':  # solve the start char specially
            cur_times = (cur_nums-1) // (str_divide_times[no]-1) # str_divide_times[no]>1
        else:
            cur_times = cur_nums // str_divide_times[no]
        if cur_times < min_times or min_times < 0:
            min_times = cur_times
    return min_times

if __name__ == '__main__':
    s = input()
    print(Nineteen(s))
 	 			  	  		 		   	  	   	 	 	