From 201d00d2ee5aea163d909b946994c6ec8a3193fb Mon Sep 17 00:00:00 2001 From: Swaraj Renghe Date: Wed, 9 Oct 2019 21:44:50 +0530 Subject: [PATCH] Added Codeforces Question --- Codeforces/Chat room.cpp | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Codeforces/Chat room.cpp diff --git a/Codeforces/Chat room.cpp b/Codeforces/Chat room.cpp new file mode 100644 index 0000000..8a9bdd9 --- /dev/null +++ b/Codeforces/Chat room.cpp @@ -0,0 +1,48 @@ +#include +#include +#include +#include +#include + +using namespace std; + +int main () { + + string s, g; + + cin >> s; + + int temp = 0; + + for (int i = 0; i < s.length(); ++i) + { + if (temp == 0 && s[i] == 'h') { + temp = 1; + } + else if (temp == 1 && s[i] == 'e') { + temp = 2; + } + else if (temp == 2 && s[i] == 'l') { + temp = 3; + } + else if (temp == 3 && s[i] == 'l') { + temp = 4; + } + else if (temp == 4 && s[i] == 'o') { + temp = 5; + break; + } + else { + + } + } + + if (temp == 5) { + cout << "YES" << endl; + } + else { + cout << "NO" << endl; + } + + return 0; +}