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.
# Problem url: https://codeforces.com/problemset/problem/393/A

string = input()

'''
Count the number of each letter and normalize by dividing by how
many of that letter are in the word nineteen. (if you have 9 e's,
you can make 3 words (9/3)) For n, you can overlap, so if you have
3 n's, you can make 1 word
5 n's, you can make 2 words
7 n's, you can make 3 words (nineteenineteenineteen)

so first find the lower odd number near to the number of n's, but if n is
0, nearest is -1, so just make that 0 if so.

Then, the number of words as a function of the number of n's is:
    W(n) = .5n - .5

This is how you normalize the number of n's. So then once you get all of those
find the min. For example if min is 2, then the lowest one was able to make
2 words, so the rest of the letters definitely will too.

'''
n = string.count('n')
n = n - (n%2 == 0) + (n == 0)
n = int(n/2 - 1/2)
i = string.count('i') // 1
e = string.count('e') // 3
t = string.count('t') // 1

print(min(n, i, e, t))