As it's the first of April, Heidi is suspecting that the news she reads today are fake, and she does not want to look silly in front of all the contestants. She knows that a newspiece is fake if it contains heidi as a subsequence. Help Heidi assess whether the given piece is true, but please be discreet about it...


-----Input-----

The first and only line of input contains a single nonempty string s of length at most 1000 composed of lowercase letters (a-z).


-----Output-----

Output YES if the string s contains heidi as a subsequence and NO otherwise.


-----Examples-----
Input
abcheaibcdi

Output
YES
Input
hiedi

Output
NO


-----Note-----

A string s contains another string p as a subsequence if it is possible to delete some characters from s and obtain p.

Difficulty: interview

Starter code:

Solutions:
string = input()
now = 0
for i in range(len(string)):
    if now == 0 and string[i] == "h":
        now += 1
    if now == 1 and string[i] == "e":
        now += 1
    if now == 2 and string[i] == "i":
        now += 1
    if now == 3 and string[i] == "d":
        now += 1
    if now == 4 and string[i] == "i":
        now += 1
if now == 5:
    print("YES")
else:
    print("NO")
    


def is_subsequence(x, y):
        x = list(x)
        for letter in y:
            if x and x[0] == letter:
                x.pop(0)
        return not x
s = input()
print("YES" if is_subsequence("heidi",s) else "NO")


s = input()
to_find = "heidi"
n = 0
for i in list(s):
    if i==to_find[n]:
        n += 1
    if n==5:
        print("YES")
        break
else:
    print("NO")


s = input()
a = 0
pat = "heidi"
for i in s:
    if i == pat[a]:
        a+=1
        if(a == 5):
            break
print("YES") if a==5 else print("NO")

s = input()
f = 0
for i in range(len(s)):
    if s[i] == 'h' and f == 0:
        f = 1
    if s[i] == 'e' and f == 1:
        f = 2
    if s[i] == 'i' and f == 2:
        f = 3
    if s[i] == 'd' and f == 3:
        f = 4
    if s[i] == 'i' and f == 4:
        f = 5
        print('YES')
if f < 5:
    print('NO')


import sys

def solve():
    s = input()

    if is_subst(s, 'heidi'):
        print('YES')
    else:
        print('NO')

def is_subst(s, t):
    tlen = len(t)
    slen = len(s)
    cnt = 0

    l = 0

    for i in range(tlen):
        for j in range(l, slen):
            if t[i] == s[j]:
                l = j + 1
                cnt += 1
                break
        else:
            l = slen

    return cnt == tlen

def __starting_point():
    solve()
__starting_point()

x=input()
y="heidi"
z=""
j=0
for i in y:
    t=True
    while j<len(x) and t:
        if x[j]==i:
            z+=i
            t=False
        j+=1
else:
    if y==z:
        print("YES")
    else:
        print("NO")

def lcs(a,b):
    lena=len(a)
    lenb=len(b)
    c=[[0 for i in range(lenb+1)] for j in range(lena+1)]
    for i in range(lena):
        for j in range(lenb):
            if a[i]==b[j]:
                c[i+1][j+1]=c[i][j]+1
            elif c[i+1][j]>c[i][j+1]:
                c[i+1][j+1]=c[i+1][j]
            else:
                c[i+1][j+1]=c[i][j+1]
    return c

a=input()
b='heidi'
s1 = lcs(a,b)
if s1[-1][5] == 5:
    print("YES")
else:
    print("NO")

s = input()

p = "heidi"

idx = 0
for c in s:
    if c == p[idx]:
        idx += 1
        if idx >= len(p): break

ans = ["NO", "YES"][idx == len(p)]
print(ans)



import sys
import math

s = input()
s2 = "heidi";
ind  = 0;
for i in range(len(s)):
    if s[i] == s2[ind]:
        ind+=1;
    if ind == len(s2):
        break;
if ind == len(s2):
    print("YES")
else:
    print("NO")

s=input()
pt='heidi'
i=0
for v in s :
    if i<5 and v==pt[i]:
        i+=1
if i==5:
    print('YES')
else :
    print('NO')


ch =input()
t=False
if ch.find('h')>=0:
    ch=ch[ch.index('h'):]
    if ch.find('e')>=0:
        ch=ch[ch.index('e'):]
        if ch.find('i')>=0:
            ch=ch[ch.index('i'):]
            if ch.find('d')>=0:
                ch=ch[ch.index('d'):]
                if ch.find('i')>=0:
                    t=True
if t:
    print('YES')
else:
    print('NO')
    


s = str(input())
j = 0
ss = 'heidi#'
for i in s:
    if i == ss[j]:
        j += 1
print ('YES' if j == 5 else 'NO')

s = input()
flag = False
ind = [0,0,0,0,0]
for i in range(len(s)):
    if s[i] == 'h':
        ind[0] = i + 1
        break
if ind[0]:
    for i in range(ind[0]-1, len(s)):
        if s[i] == 'e':
            ind[1] = i + 1
            break
if ind[1]:
    for i in range(ind[1]-1, len(s)):
        if s[i] == 'i':
            ind[2] = i + 1
            break
if ind[2]:
    for i in range(ind[2]-1, len(s)):
        if s[i] == 'd':
            ind[3] = i + 1
            break
if ind[3]:
    for i in range(ind[3]-1, len(s)):
        if s[i] == 'i':
            ind[4] = i + 1
            flag = True
            break
print('YES' if flag else'NO')

inp = input()
result = 0
ans = 1
for alp in 'heidi':
	inp = inp[result:]
	result = inp.find(alp)
	#print (alp, result)
	if result == -1:
		ans = 0
		break

if ans:
	print ('YES')
else:
	print ('NO')

s = input()
patern = "heidi"
prev = 0
for c in patern:
  ok = False
  for i in range(prev, len(s)):
    prev += 1
    if s[i] == c:
      ok = True
      break
  if not ok:
    print ("NO\n")
    return
print ("YES\n")

a=input()
j=0
s='heidi#'
for i in a:
    if i==s[j]:j+=1
print('YES'if j==5else'NO')


s,c='heidi',0
for i in input():
  if i==s[c]:c+=1
  if c==5:break
print('YES' if c==5 else 'NO')


a=str(input(""))
length=len(a)
#print(a.find("h"))
if a.find("h")!=-1:
    a=a[(a.find("h")+1):]
    #print(a)
    if a.find("e")!=-1:
        a=a[(a.find("e")+1):]
        #print(a)
        if a.find("i")!=-1:
            a=a[(a.find("i")+1):]
            #print(a)
            if a.find("d")!=-1:
                a=a[(a.find("d")+1):]
                #print(a)
                if a.find("i")!=-1:
                    print("YES")
                    return
                else:
                    print("NO")
                    return
            else:
                print("NO")
                return
        else:
            print("NO")
            return
    else:
        print("NO")
        return
else:
    print("NO")
    return




import sys

s = input()

counter = 0

f = "heidi"

for i in range(len(s)):
    if s[i] == f[counter]:
        counter += 1
    if counter > 4:
        print("YES")
        return
print("NO")


s = input()
m= 'heidi'
for c in m:
	a = s.find(c)
	if a==-1:
		print('NO')
		return
	s = s[a+1:]
#	print(a, c, m, s)
print('YES')


import sys
s = input()
a = s.find("h")
if a != -1:
    s = s[a:]
    a = s.find("e")
    if a != -1:
        s = s[a:]
        a = s.find("i")
        if a != -1:
            s = s[a:]
            a = s.find("d")
            if a != -1:
                s = s[a:]
                a = s.find("i")
                if a != -1:
                    print("YES")
                    return
print("NO")


n=str(input())
st="heidi"
cnt=0
for i in n:
    if i==st[cnt]:
        cnt+=1
    if(cnt==5):
        break;
print('YES' if cnt==5 else 'NO')