Hello Friend- Editorial || BADWORD

PROBLEM LINK: Hello Friend | CodeChef

Problem Code: Hello Friend | CodeChef

Practice: CodeChef | Competitive Programming | Participate & Learn | CodeChef

Contest : Campus Code October Edition Coding Competition | CodeChef

Author: Codechef Adgitm Chapter : https://www.codechef.com/users/test_account_9
Tester: Codechef Adgitm Chapter : https://www.codechef.com/users/test_account_9
Editorialist: Codechef Adgitm Chapter : https://www.codechef.com/users/test_account_9

DIFFICULTY:

CAKEWALK

PREREQUISITES:

Basic Looping, basic Input Output

PROBLEM:

This spring Chef met his childhood friend. Everything went well but the chef saw that his friend is still bad with words in English. Chef took this to heart and thought of helping his friend out. Chef is gonna help him spell only one word which is “hello”, so as to give him a good and easy start. Moreover, he will ignore any alphabet before and after “hello” (“yahellosh” is also correct for the chef).if string contain hello output YES else output NO.

NOTE- there should be no mistake in “hello” spelling.

EXPLANATION:
Match all the alphabets of String(Input) with hello.

SOLUTION:
C++:
#include<bits/stdc++.h>

#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long int
using namespace std;
string solve(){
string s;
cin>>s;
int n=s.length();
for(int i=0;i<n-4;i++){
if(s[i]==‘h’&&s[i+1]==‘e’&&s[i+2]==‘l’&&s[i+3]==‘l’&&s[i+4]==‘o’)
return “YES”;
}
return “NO”;
}
int32_t main()
{
int t;cin>>t;
while(t–){
cout<<solve()<<endl;
}
}