393_A. Nineteen
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.

Input

The first line contains a non-empty string s, consisting only of lowercase English letters. The length of string s doesn't exceed 100.

Output

Print a single integer — the maximum number of "nineteen"s that she can get in her string.

Examples

Input

nniinneetteeeenn


Output

2

Input

nneteenabcnneteenabcnneteenabcnneteenabcnneteenabcii


Output

2

Input

nineteenineteen


Output

2
```python
a=input()
n=int(0)
ii=int(0)
t=int(0)
e=int(0)
for i in range(len(a)):
    if a[i] == "n":
        n+=1
    if a[i] == "i":
        ii+=1
    if a[i] == "e":
        e+=1
    if a[i] == "t":
        t+=1
if n >3:
    n=int(((n-3)/2))+1
else:
    n=int(n/3)
print(min(n,int(e/3),ii,t))
```