58A. Chat room
greedy, strings, 1000, http://codeforces.com/problemset/problem/58/A
思路:逐个检查即可,用时约10min
cpp
#include <iostream>
using namespace std;
const string standard = "hello";
bool check(string input)
{
int p = 0;
for (auto i : input)
{
if (i == standard[p]) p++;
if (p == standard.length()) return true;
}
return false;
}
int main()
{
string input;
cin >> input;
if (check(input))
cout << "YES";
else
cout << "NO";
return 0;
}