fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. void Fast();
  4. void solve();
  5. int main()
  6. {
  7. Fast();
  8. solve();
  9. return 0;
  10. }
  11. void Fast()
  12. {
  13. ios_base::sync_with_stdio(0);
  14. cin.tie(0);
  15. cout.tie(0);
  16. }
  17. void solve()
  18. {
  19. string s, cp = "", hel = "hello";
  20. cin >> s;
  21. for (int i = 0; i < s.size(); i++)
  22. {
  23. if (s[i] == 'h' && s[i + 1] == 'e')
  24. {
  25. cp.push_back(s[i]);
  26. cp.push_back(s[i + 1]);
  27. }
  28. if (s[i] == 'l' && s[i - 1] == 'e' && s[i + 1] == 'l')
  29. {
  30. cp.push_back(s[i]);
  31. cp.push_back(s[i + 1]);
  32. }
  33. if (s[i] == 'o' && s[i - 1] == 'l'&& s[i - 2] == 'l')
  34. {
  35. cp.push_back(s[i]);
  36. }
  37. }
  38. if (hel == cp)
  39. cout << "YES\n";
  40. else
  41. cout << "NO\n";
  42. }
Success #stdin #stdout 0.01s 5528KB
stdin
Standard input is empty
stdout
NO