-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathA_Chat_room.cpp
45 lines (43 loc) · 956 Bytes
/
A_Chat_room.cpp
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
36
37
38
39
40
41
42
43
44
45
#include <iostream>
using namespace std;
typedef long long ll;
string s;
string ans = "";
bool h, e, l1, l2, o;
int main() {
cin >> s;
int n = s.size();
for (int i = 0; i < n; i++) {
if(s[i] == 'h' || s[i] == 'e' || s[i] == 'l' || s[i] == 'o') {
ans += s[i];
}
}
for(int i = 0 ; i < ans.size() ; i++) {
if(!h) {
if(ans[i] == 'h') {
h = true;
}
}else if(!e) {
if(ans[i] == 'e') {
e = true;
}
}else if(!l1) {
if(ans[i] == 'l') {
l1 = true;
}
}else if(!l2) {
if(ans[i] == 'l') {
l2 = true;
}
}else if(!o) {
if(ans[i] == 'o') {
o = true;
}
}
}
if(h && e && l1 && l2 && o) {
cout << "YES" << endl;
}else {
cout << "NO" << endl;
}
}