Check whether a given word can be formed as a subsequence of the string "hello".
Problem
Given a string, determine whether the word "hello" appears as a subsequence. You may delete some characters from the string without changing the order of the remaining characters.
Print YES if you can obtain hello, otherwise print NO.
A subsequence does not require characters to be contiguous, but their relative order must stay the same.
Input Format
A single string consisting of lowercase English letters.
Output Format
Print YES if hello is a subsequence of ; otherwise print NO.
Constraints
- contains only lowercase English letters
Example 1
Input
ahhellllloou
Output
YES
Explanation
We can pick the characters h, e, l, l, o in order to form hello.
Example 2
Input
hlelo
Output
NO
Explanation
Although all letters are present, the order is not correct for the subsequence hello.
Premium problem context
Unlock deeper context for this problem
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.