不要让昨天 占据你的今天 夏午晴天

夏午晴天

Chat room

/*

Vasya has recently learned to type and log on to the Internet. He immediately entered a chat room and decided to say hello to everybody. Vasya typed the word s. It is considered that Vasya managed to say hello if several letters can be deleted from the typed word so that it resulted in the word "hello". For example, if Vasya types the word "ahhellllloou", it will be considered that he said hello, and if he types "hlelo", it will be considered that Vasya got misunderstood and he didn't manage to say hello. Determine whether Vasya managed to say hello by the given word s.

Input

The first and only line contains the word s, which Vasya typed. This word consisits of small Latin letters, its length is no less that 1 and no more than 100 letters.

Output

If Vasya managed to say hello, print "YES", otherwise print "NO".

Example

Input
ahhellllloou
Output
YES
Input
hlelo
Output
NO

*/
#include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;

char a[110];

int main()
{
    cin >> a;
    getchar();
    int k = 0;
    int i,j,n,m,v;
    for(i = 0; i <= strlen(a); i ++)
    {
        if(a[i] == 'h')
        {
            k ++;
            int I=i;
            i=strlen(a);
            //cout  << k << endl;
            for(int j = (I+1); j <= strlen(a); j++)
            {
                if(a[j] == 'e')
                {
                    k++;
                    int J=j;
                    j=strlen(a);
                    for(int n = J+1; n <= strlen(a); n++)
                    {
                        if(a[n] == 'l')
                        {
                            k++;
                            int N=n;
                            n=strlen(a);
                            //cout  << k << endl;
                            for(int m = N+1; m <= strlen(a); m++)
                            {
                                if(a[m] == 'l')
                                {
                                    k++;
                                    int M=m;
                                    m=strlen(a);
                                    //cout  << k << endl;
                                    for(int v = M+1; v <= strlen(a); v++)
                                    {
                                        if(a[v] == 'o')
                                            {
                                                k++;
                                                v=strlen(a);
                                            }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if(k >= 5)
        cout << "YES" <<endl;
    else cout << "NO" <<endl;
    //cout  << k << endl;
    return 0;
}

 

 

posted on 2017-02-23 13:40  夏晴天  阅读(1018)  评论(0编辑  收藏  举报

导航

Live2D