-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy path58A.cpp
More file actions
35 lines (30 loc) · 743 Bytes
/
58A.cpp
File metadata and controls
35 lines (30 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define debug(n) cout<<(n)<<endl;
const ll INF = 2e18 + 99;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string s, r = "";
cin>>s;
for(auto i : s){
if(i == 'h' && r == ""){
r += i;
}
else if(i == 'e' && r[r.length() - 1] == 'h'){
r += i;
}
else if(i == 'l' && r[r.length() - 1] == 'e'){
r += i;
}
else if(i == 'l' && r[r.length() - 2] == 'e' && r[r.length() - 1] == 'l'){
r += i;
}
else if(i == 'o' && r[r.length() - 1] == 'l' && r[r.length() - 2] == 'l' && r[r.length() - 3] == 'e'){
r += i;
}
}
(r == "hello") ? cout<<"YES"<<endl : cout<<"NO"<<endl;
}