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.
"""from math import *
from sys import *
from collections import defaultdict
M=10**9+7
def pow(a,b):
    res=1
    while b>0:
        if b&1:
            res*=a
        a*=a
        b>>=1
    return res
def powmod(a,b,m):
    res=1
    while b>0:
        if b&1:
            res=((res*a)%m)
        a*=a
        b>>=1
    return res
def inv(a,m):
    return powmod(a,m-2,m)

def factor(n):
    potentional_p = 3
    itog_list = {}
    if n % 2 == 0:
        itog_list[2] = 0
    while n % 2 == 0:
        n = n // 2
        itog_list[2] += 1
    while n - 1:
        if potentional_p > (n**0.5):
            if n in itog_list:
                itog_list[n] += 1
            else:
                itog_list[n] = 1
            return itog_list
        while n % potentional_p == 0:
            n = n // potentional_p
            if potentional_p in itog_list:
                itog_list[potentional_p] += 1
            else:
                itog_list[potentional_p] = 1
        potentional_p += 2
    return itog_list
def meth(ss):
    n=0
    i=0
    e=0
    t=0
    for x in ss:
        if x=='n':
            n+=1
        elif x=='i':
            i+=1
        elif x=='e':
            e+=1
        elif x=='t':
            t+=1
    x=min(n,e)
    y=min(i,t)
    return max(min(x//3,y),min((x+1)//3,y))

    


s=input()
temp=""
res=0
for x in s:
    if x=='n':
        temp+='n'
    elif x=='i':
        temp+='i'
    elif x=='e':
        temp+='e'
    elif x=='t':
        temp+='t'
    else:
        if temp!="":
            print(temp)
            res+=meth(temp)
            temp=""
if temp!="":
    res+=meth(temp)
print(res)
    
# nnn i eee t

"""





from math import *
from sys import *
from collections import defaultdict
M=10**9+7
def pow(a,b):
    res=1
    while b>0:
        if b&1:
            res*=a
        a*=a
        b>>=1
    return res
def powmod(a,b,m):
    res=1
    while b>0:
        if b&1:
            res=((res*a)%m)
        a*=a
        b>>=1
    return res
def inv(a,m):
    return powmod(a,m-2,m)
 
def factor(n):
    potentional_p = 3
    itog_list = {}
    if n % 2 == 0:
        itog_list[2] = 0
    while n % 2 == 0:
        n = n // 2
        itog_list[2] += 1
    while n - 1:
        if potentional_p > (n**0.5):
            if n in itog_list:
                itog_list[n] += 1
            else:
                itog_list[n] = 1
            return itog_list
        while n % potentional_p == 0:
            n = n // potentional_p
            if potentional_p in itog_list:
                itog_list[potentional_p] += 1
            else:
                itog_list[potentional_p] = 1
        potentional_p += 2
    return itog_list
s=input()
n=0
i=0
e=0
t=0
for x in s:
    if x=='n':
        n+=1
    if x=='i':
        i+=1
    if x=='e':
        e+=1
    if x=='t':
        t+=1
# nnn i eee t
x=min(n,e)
y=min(i,t)
 
#print(min(x//3,y))
print(max(min(x//3,y),min((x+1)//3,y)))






