Skip to main content
Back to problems
Codeforces
Easy
Strings
Chat room

Check whether a given word can be formed as a subsequence of the string "hello".

Acceptance 0%
Also Available On
Other platform versions and source mappings for the same problem.
Problem Statement

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 ss consisting of lowercase English letters.

Output Format

Print YES if hello is a subsequence of ss; otherwise print NO.

Constraints

  • 1s1001 \le |s| \le 100
  • ss contains only lowercase English letters
Examples
Sample cases returned by the problem API.

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.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.